1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-02 00:38:31 +09:00

API modules as import syntax (#4069)

This commit is contained in:
Acid Chicken (硫酸鶏) 2019-01-31 23:32:58 +09:00 committed by syuilo
parent c34a278533
commit f35547f3b8
4 changed files with 14 additions and 10 deletions

View File

@ -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 => {

View File

@ -303,4 +303,4 @@ router.get('/dc/cb', async ctx => {
}
});
module.exports = router;
export default router;

View File

@ -271,4 +271,4 @@ router.get('/gh/cb', async ctx => {
}
});
module.exports = router;
export default router;

View File

@ -185,4 +185,4 @@ router.get('/tw/cb', async ctx => {
}
});
module.exports = router;
export default router;