|
|
@@ -5,21 +5,25 @@ const router = express.Router();
|
|
|
|
|
|
|
|
|
module.exports = (crowi) => {
|
|
|
- const { boltService } = crowi;
|
|
|
+ const { boltService, boltRecieverService, express } = crowi;
|
|
|
|
|
|
- router.get('/', async(req, res) => {
|
|
|
- const app = boltService.getBoltAppInstance();
|
|
|
+ router.get('/:endpoints', async(req, res) => {
|
|
|
+
|
|
|
+ const expressApp = express;
|
|
|
+ // this.server = createServer(this.app);
|
|
|
+ const { endpoints } = req.params;
|
|
|
+
|
|
|
+ for (const endpoint of endpoints) {
|
|
|
+ expressApp.post(endpoint, boltRecieverService.requestHandler.bind(this));
|
|
|
+ }
|
|
|
+
|
|
|
+ const boltApp = boltService.getBoltAppInstance();
|
|
|
|
|
|
// TODO: improve event method
|
|
|
- app.event('message', async({ event, client }) => {
|
|
|
+ boltApp.event('message', async({ event, client }) => {
|
|
|
// Do some slack-specific stuff here
|
|
|
await client.chat.postMessage('hogehoge');
|
|
|
});
|
|
|
-
|
|
|
- (async() => {
|
|
|
- await app.start(8080);
|
|
|
- console.log('app is running');
|
|
|
- })();
|
|
|
});
|
|
|
|
|
|
|