A
A
alex4answ2020-08-28 08:15:16
Express.js
alex4answ, 2020-08-28 08:15:16

Why inherit express applications?

Good morning, met the design:

const app   = express();
const admin = express();

admin.get('/admin', (req, res) => {
  res.send('admin');
});

app.get('/admin', admin);


Why do this?
After all, this is what Router is for.const admin = express.Router();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2020-08-28
@alex4answ

surely then these two expresses are launched each on their own port, in the spirit of

app.listen(3000)
admin.listen(3001)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question