Closed sam-ji closed 6 years ago
You are mixing the manual approach of makeInvoker
and the use of loadControllers
😄
If you wish to use loadControllers
, update your route to use createController
like so:
const { createController } = require('awilix-express')
function makeAPI({ todosService }) {
return {
getTodos: (req, res) => {
return res.send(todosService.getTodos())
}
}
}
module.exports = createController(makeAPI)
.get('/todos', 'getTodos')
I have this project structure:
src: server.js routes todos.js
server.js
routes/todos.js
I cannot get any response @GET/todos
Is that related to the usage of module.exports instead of exports? Any insight in how to make this work? Thanks in advance!