Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require("express");
- const bodyParser = require("body-parser");
- const app = express();
- app.use(bodyParser.json());
- app.post("/requestVote", (req, res) => {
- const { term, candidateId, lastLogIndex, lastLogTerm } = req.body;
- const response = {
- term: "term",
- voteGranted: true,
- };
- res.json(response);
- });
- app.post("/appendEntries", (req, res) => {
- const { term, leaderId, prevLogIndex, prevLogTerm, entries, leaderCommit } =
- req.body;
- const response = {
- term: term,
- success: true,
- };
- res.json(response);
- });
- app.post("/executeCommand", (req, res) => {
- const command = req.body;
- const response = "OK";
- res.send(response);
- });
- app.listen(3000, () => {
- console.log("Server listening on port 3000");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement