Skip to content

Instantly share code, notes, and snippets.

@kamal-hossain
Last active September 11, 2021 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamal-hossain/1504292edffb9888352d01310d59232a to your computer and use it in GitHub Desktop.
Save kamal-hossain/1504292edffb9888352d01310d59232a to your computer and use it in GitHub Desktop.
Express js node js server

Simple web server for ndoejs, using Express.

const express = require('express')
const app = express()
app.use(express.json())
app.use((r, res, next) => {
console.log(r.url)
next()
})
app.get('/', (req, res) => {
res.status(200).json({
message: 'server running on 3000',
})
})
app.post('/', (req, res) => {
console.log(req.body)
res.status(200).json({
message: 'Watch request body on server console.log()',
})
})
app.listen(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment