Created
October 27, 2018 13:23
-
-
Save vahideng/eba2d9f6c84b7fb5c639d95775cdab6f to your computer and use it in GitHub Desktop.
Simple express middleware yo handle two routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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