Created
December 9, 2023 11:30
-
-
Save rishavk1102/9c8d44a3709e171d0411de2d444898cd to your computer and use it in GitHub Desktop.
Boiler Plate NodeJS Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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