Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
untitled notebook
node v10.24.1
version:
64.0.5
endpoint
share
tweet
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