mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-13 22:28:58 +09:00
API modules as import syntax (#4069)
This commit is contained in:
parent
c34a278533
commit
f35547f3b8
@ -9,8 +9,12 @@ import * as bodyParser from 'koa-bodyparser';
|
||||
const cors = require('@koa/cors');
|
||||
|
||||
import endpoints from './endpoints';
|
||||
|
||||
const handler = require('./api-handler').default;
|
||||
import handler from './api-handler';
|
||||
import signup from './private/signup';
|
||||
import signin from './private/signup';
|
||||
import discord from './service/discord';
|
||||
import github from './service/github';
|
||||
import twitter from './service/twitter';
|
||||
|
||||
// Init app
|
||||
const app = new Koa();
|
||||
@ -49,12 +53,12 @@ for (const endpoint of endpoints) {
|
||||
}
|
||||
}
|
||||
|
||||
router.post('/signup', require('./private/signup').default);
|
||||
router.post('/signin', require('./private/signin').default);
|
||||
router.post('/signup', signup);
|
||||
router.post('/signin', signin);
|
||||
|
||||
router.use(require('./service/discord').routes());
|
||||
router.use(require('./service/github').routes());
|
||||
router.use(require('./service/twitter').routes());
|
||||
router.use(discord.routes());
|
||||
router.use(github.routes());
|
||||
router.use(twitter.routes());
|
||||
|
||||
// Return 404 for unknown API
|
||||
router.all('*', async ctx => {
|
||||
|
@ -303,4 +303,4 @@ router.get('/dc/cb', async ctx => {
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
@ -271,4 +271,4 @@ router.get('/gh/cb', async ctx => {
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
@ -185,4 +185,4 @@ router.get('/tw/cb', async ctx => {
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
export default router;
|
||||
|
Loading…
Reference in New Issue
Block a user