node.js – How to reload the page in Express / nodejs


I created a new project with Express and Nodejs, where I defined a "/status" route. Each time this route is accessed, it must run a routine in the /routes/status.js script. Example: If I run an F5 in the browser with the address , I would have run /routes/status.js , but that doesn't happen.

I imagine this behavior is natural to Express. But how do I get it to run in the way I've described or any other way?


Are you using some module to load your route, otherwise I indicate a consign one. You will install via npm

npm install --save consign

It will import in your application

var consign = require('consign');

Define where the routes will be


And it will normally create its status.js file receiving

module.exports = function(app){'/status', function(req, res){
    //aqui vc direciona para sua view       


Scroll to Top