Skip to content

Instantly share code, notes, and snippets.

@vahideng
Created October 27, 2018 13:23
Show Gist options
  • Save vahideng/eba2d9f6c84b7fb5c639d95775cdab6f to your computer and use it in GitHub Desktop.
Save vahideng/eba2d9f6c84b7fb5c639d95775cdab6f to your computer and use it in GitHub Desktop.
Simple express middleware yo handle two routes
const express = require('express');
const app = express();
app.use('/user', (req, res, next) => {
console.log('in first Middleware');
res.send('<h1> Hello From second Page</h1>');
});
app.use('/', (req, res, next) => {
console.log('in secon middleware');
res.send('<h1> Hello From fist Page</h1>');
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment