summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorAcid Chicken (硫酸鶏) <root@acid-chicken.com>2019-01-31 23:32:58 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-01-31 23:32:58 +0900
commitf35547f3b8fef605a3ba34136a87f83cddb5f49f (patch)
tree3ea2719193d8ac1d832b53e744400ffe4e672900 /src/server
parentおすすめのアンケートでミュートユーザーのものは表示... (diff)
downloadsharkey-f35547f3b8fef605a3ba34136a87f83cddb5f49f.tar.gz
sharkey-f35547f3b8fef605a3ba34136a87f83cddb5f49f.tar.bz2
sharkey-f35547f3b8fef605a3ba34136a87f83cddb5f49f.zip
API modules as import syntax (#4069)
Diffstat (limited to 'src/server')
-rw-r--r--src/server/api/index.ts18
-rw-r--r--src/server/api/service/discord.ts2
-rw-r--r--src/server/api/service/github.ts2
-rw-r--r--src/server/api/service/twitter.ts2
4 files changed, 14 insertions, 10 deletions
diff --git a/src/server/api/index.ts b/src/server/api/index.ts
index 17a2579f22..c9e1107fc5 100644
--- a/src/server/api/index.ts
+++ b/src/server/api/index.ts
@@ -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 => {
diff --git a/src/server/api/service/discord.ts b/src/server/api/service/discord.ts
index 1118e241d4..d7a3b93ac9 100644
--- a/src/server/api/service/discord.ts
+++ b/src/server/api/service/discord.ts
@@ -303,4 +303,4 @@ router.get('/dc/cb', async ctx => {
}
});
-module.exports = router;
+export default router;
diff --git a/src/server/api/service/github.ts b/src/server/api/service/github.ts
index 5934e96f63..e26a225993 100644
--- a/src/server/api/service/github.ts
+++ b/src/server/api/service/github.ts
@@ -271,4 +271,4 @@ router.get('/gh/cb', async ctx => {
}
});
-module.exports = router;
+export default router;
diff --git a/src/server/api/service/twitter.ts b/src/server/api/service/twitter.ts
index ff7f985279..f7f023d828 100644
--- a/src/server/api/service/twitter.ts
+++ b/src/server/api/service/twitter.ts
@@ -185,4 +185,4 @@ router.get('/tw/cb', async ctx => {
}
});
-module.exports = router;
+export default router;