EXPRESS API code example

Example 1: express redirect

res.redirect('/foo/bar')
res.redirect('http://example.com')
res.redirect(301, 'http://example.com')
res.redirect('../login')

Example 2: http header express

app.get('/', (req, res) => {
  req.header('User-Agent')
})
// Use the Request.header() method to access
//one individual request header’s value

Example 3: express

Express.js, or simply Express, is a web application framework for Node.js,
released as free and open-source software under the MIT License.

It is designed for building web applications and APIs.
It has been called the de facto standard server framework for Node.js.

Example 4: express api

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

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

Example 5: express get

app.get('/index', (req, res) => {
    res.render('index')
})

Tags:

Misc Example