node.js - Prevent direct access to html page in node js -
I would like to stop the user from typing directly in the URL of the page and going to the page. How do I get this functionality in node? I know that they do not have direct access to web applications in web applications to keep files under file. If you are using, then you can check the referrer in the middleware like this in the middleware, Which you can further customize as necessary for your exact purposes: var Express = requirement ('Express') var app = express () allowed lamp = ['localhost' '127.0.0.1']; // which can link here? App.use (function (req, res, next) {var i = 0, notfound = 1, referer = req.get ('referrer'); if ((req.path === '/') || (req .path === '')) Next (); // pass call '/' always if (referrer) {while ((I and LT; permission lamp lamp) & amp; amp; not; found =) (Notfound = (referer.indexOf permission linker [i]) === - 1); i ++;}} if (notfand) {res.status (403) .seend ('protected area. Enter ...