Skip to content

Instantly share code, notes, and snippets.

@rishavk1102
Created December 9, 2023 11:30
Show Gist options
  • Save rishavk1102/9c8d44a3709e171d0411de2d444898cd to your computer and use it in GitHub Desktop.
Save rishavk1102/9c8d44a3709e171d0411de2d444898cd to your computer and use it in GitHub Desktop.
Boiler Plate NodeJS Server
const express = require("express");
const app = express();
let port = process.env.PORT || 3000;
app.route('/')
.get((req, res) => {
console.log(req.body);
res.sendStatus(200);
})
.post((req, res) => {
console.log(req.body);
res.sendStatus(200);
})
.put((req, res) => {
console.log(req.body);
res.sendStatus(200);
})
.delete((req, res) => {
console.log(req.body);
res.sendStatus(200);
});
app.listen(port, () => {
console.log("Webserver running on 3000");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment