Closed josteph closed 5 years ago
Hello, I am fairly new to express.
How do I add prefix to express router with this module? Normally it would be done like below:
const express = require('express') const app = express() app.post('/user/login', (req, res) => { // }) module.exports = { path: '/api', handler: app }
or app.use('/api', router)
app.use('/api', router)
But in here, I can't use const app = express(), it will produce this error: error TypeError: require(...) is not a function
const app = express()
error TypeError: require(...) is not a function
Thanks for any help.
Hello, I am fairly new to express.
How do I add prefix to express router with this module? Normally it would be done like below:
or
app.use('/api', router)
But in here, I can't use
const app = express()
, it will produce this error:error TypeError: require(...) is not a function
Thanks for any help.