-
Notifications
You must be signed in to change notification settings - Fork 426
how to attach middleware like express.static ? #587
Copy link
Copy link
Closed
Labels
questionM-T: User needs support to use the projectM-T: User needs support to use the project
Description
Description
I want to send some static files from an app that's also using Bolt.
as per the docs here
I can get the bolt "router" but can't use the normal method to attach express.static middleware.
const receiver = new ExpressReceiver({ signingSecret: AppConfig.signingSecret });
app.use(eventLogger) // my own custom middleware
// but this doesnt work
// app.use('/cdn', express.static('/cdn'))
currently I have to wire it up with manual send file:
receiver.router.get('/cdn/*', (req, res) => {
logger.log('cnd get', req.path)
const fp = path.join(__dirname, '../../../', req.path)
res.contentType('image/jpeg');
res.sendFile(fp);
})
What type of issue is this? (place an x in one of the [ ])
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x in each of the [ ])
- I've read and understood the Contributing guidelines and have done my best effort to follow them.
- I've read and agree to the Code of Conduct.
- I've searched for any related issues and avoided creating a duplicate issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionM-T: User needs support to use the projectM-T: User needs support to use the project