Answers for "how to call api in express js"

5

nodejs express api

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})
Posted by: Guest on April-15-2021
0

how to send response in express js

(req, res) => res.send('Hello World!')
//Use end() to send an empty response
res.end()
res.status(404).end()// for not found pages
//use either
//res.status(404).send('File not found') === res.sendStatus(404)
Posted by: Guest on August-19-2021
0

express api

app.render('email', function (err, html) {
  // ...
})

app.render('email', { name: 'Tobi' }, function (err, html) {
  // ...
})
Posted by: Guest on February-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language