untitled notebook

node v10.24.1
version: 64.0.5
endpointsharetweet
const express = require('express') const bp = require('body-parser') const app = express() const port = 3000 app.use(bp.json()) app.use(bp.urlencoded({ extended: true })) app.post('/', (req, res) => { console.log("body is",req.body); res.send('Hello World! POST') }) app.get('/', (req, res) => { res.send({ "message": "Hello World" }) }) app.get('/new/failure123', (req, res) => { res.status(500).send({ "message": "Internal Server error" }); }); app.get('/new/failure', (req, res) => { res.send({ "message": "Hello World" }) }); app.listen(port, () => { console.log(`Example app listening on port ${port}`) })
Created from: https://expressjs.com/en/starter/hello-world.html
Loading…

no comments

    sign in to comment