Answer the question
In order to leave comments, you need to log in
Node.js: how to do routing correctly?
I need to use many locations on one server. I'm trying to organize this via app.use. But in the process, the engine starts to swear. How to specify it correctly?
applications folder:
--- application that routes
--- chat
--- other applications
Errors:
Error: No default engine was specified and no extension was provided.
at new View (C:\chat2\chat2\node_modules\express\lib\view.js:62:11)
at Function.render (C:\chat2\chat2\node_modules\express\lib\application.js:570:12 )
at ServerResponse.render (C:\chat2\chat2\node_modules\express\lib\response.js:971:7)
at C:\chat2\chat2\chat\index.js:41:9
at Layer.handle [as handle_request] (C:\chat2\chat2\node_modules\express\lib\router\layer.js:95:5)
at next (C:\chat2\chat2\node_modules\express\lib\router\route.js:137: 13)
at Route.dispatch (C:\chat2\chat2\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\chat2\chat2\node_modules\express\ lib\router\layer.js:95:5)
at C:\chat2\chat2\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\chat2\chat2\node_modules\express\lib\router\index.js:335:12 )
Answer the question
In order to leave comments, you need to log in
It was necessary to pass io and take it to a level above engine.
module.exports = function(io, db) {
...
return router;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question