The probot documentation mentions that I can use routes just like I would in a vanilla Express server.
I wantr to set CORS origin headers for these routes. In a vanilla Express server I would use the cors package:
const cors = require('cors')
...
app.use(cors())
But the probot app does not have the function use
.
module.exports = app => {
app.use(cors(corsOptions));
// ...
causes the error:
ERROR (event): app.use is not a function
TypeError: app.use is not a function
How do I set CORS?
You must start the app programmatically. This way you can access the Express app AFTER probot loads but BEFORE Probot starts running:
Here some GitHub issues and docs that helped me answer my question: