I don’t understand how to use the next
function described there.
- next - a function. Calling this function will pass on the handling of this request to the next relevant handler.
Can some1 post an exampl plz?
I don’t understand how to use the next
function described there.
- next - a function. Calling this function will pass on the handling of this request to the next relevant handler.
Can some1 post an exampl plz?
You can define multiple handlers:
WebApp.connectHandlers.use('/', (req, res, next) => {
// do something
});
WebApp.connectHandlers.use('/', (req, res, next) => {
res.writeHead(200);
res.end(`Hello world from: ${Meteor.release}`);
});
Those handlers will be executed one by one. However you should call next to allow the other handler to be called like below:
WebApp.connectHandlers.use('/', (req, res, next) => {
// do something
next();
});
Thanks. Hard to guess by itself… dough
Its documented in 2 places. On is the docs itself:
Its also documented in the connect
docs:
The Meteor docs also provide a reference to this documentation by mentioning that webapp exposes the connect api