req.secure
This property has the value true, if the connection is
secured (https), else false.
index.js
const express = require('express') var cookieParser = require('cookie-parser') const app = express() app.use(cookieParser()); app.get('/', (req, res) => { res.send(`Is Secured Connection : ${req.secure}`) }) const port = 3000 app.listen(port, () => console.log(`Application started listening on port ${port}!`));
Run index.js. Open the url ‘http://localhost:3000/’ in
browser. You can see below message in console.
No comments:
Post a Comment