Tuesday 26 February 2019

Express: app.disable(name): Disable the boolean property


app.disable(name)
Sets the Boolean setting name to false.

index.js
var express = require('express')

var app = express()

app.set('version', '1.2.31')
app.set('maintenanceSupported', true)

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

app.get('/appinfo', (req, res) => {
 version = app.get('version')
 maintenanceSupported = app.get('maintenanceSupported')
 
 res.send(`maintenanceSupported : ${maintenanceSupported}, <br />version : ${version}`)
})

app.get('/disableMaintenance', (req, res) => {
 app.disable('maintenanceSupported')
 version = app.get('version')
 maintenanceSupported = app.get('maintenanceSupported')
 
 res.send(`maintenanceSupported : ${maintenanceSupported}, <br />version : ${version}`)
})

app.listen(3000, () => {console.log("Application started in port 3000")});

Run index.js.

Hit below url to get application information.




Previous                                                 Next                                                 Home

No comments:

Post a Comment