From 737c637022f99f806cb42479c1fdd786321d6366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Myeongjae=20Kim=20=E1=84=80=E1=85=B5=E1=86=B7=E1=84=86?= =?UTF-8?q?=E1=85=A7=E1=86=BC=E1=84=8C=E1=85=A2?= Date: Sun, 27 Oct 2019 20:14:30 +0900 Subject: [PATCH] [#22] Rename NextApp to NextApplication --- server/main/common/api/CommonController.ts | 4 ++-- server/main/common/inversify/createApp.ts | 4 ++-- server/main/common/inversify/createContainer.ts | 4 ++-- .../main/common/nextjs/{NextApp.ts => NextApplication.ts} | 4 ++-- server/main/index.ts | 6 +++--- server/main/mother/api/MotherController.ts | 4 ++-- server/main/mother/notice/api/NoticeController.ts | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) rename server/main/common/nextjs/{NextApp.ts => NextApplication.ts} (82%) diff --git a/server/main/common/api/CommonController.ts b/server/main/common/api/CommonController.ts index 5fe943f..667e257 100644 --- a/server/main/common/api/CommonController.ts +++ b/server/main/common/api/CommonController.ts @@ -1,14 +1,14 @@ import { Request, Response } from "express"; import { inject } from "inversify"; import { controller, httpGet, interfaces, request, response } from "inversify-express-utils"; -import { NextApp } from "server/main/common/nextjs/NextApp"; +import { NextApplication } from "server/main/common/nextjs/NextApplication"; const PATH = "/" @controller(PATH) export class CommonController implements interfaces.Controller { - constructor(@inject("NextApp") private nextApp: NextApp) { } + constructor(@inject("NextApp") private nextApp: NextApplication) { } @httpGet("/") public get( diff --git a/server/main/common/inversify/createApp.ts b/server/main/common/inversify/createApp.ts index bd3fa2c..820cef7 100644 --- a/server/main/common/inversify/createApp.ts +++ b/server/main/common/inversify/createApp.ts @@ -7,7 +7,7 @@ import Optional from 'optional-js'; import I18NService from 'src/common/service/I18NService'; import "../../mother/notice/api/NoticeController"; import { defaultErrorHandler } from "../error/DefaultErrorHandler"; -import { NextApp } from '../nextjs/NextApp'; +import { NextApplication } from '../nextjs/NextApplication'; export const createApp = (container: Container, errorHandlers?: ErrorRequestHandler[]) => new InversifyExpressServer(container) .setConfig((theApp) => { @@ -23,7 +23,7 @@ export const createApp = (container: Container, errorHandlers?: ErrorRequestHand Optional.ofNullable(errorHandlers) .map(handlers => handlers.forEach(h => theApp.use(h))); - const handle = new NextApp().get().getRequestHandler(); + const handle = new NextApplication().get().getRequestHandler(); theApp.use(defaultErrorHandler); }) diff --git a/server/main/common/inversify/createContainer.ts b/server/main/common/inversify/createContainer.ts index f6b3b3d..8745966 100644 --- a/server/main/common/inversify/createContainer.ts +++ b/server/main/common/inversify/createContainer.ts @@ -1,5 +1,5 @@ import { Container } from 'inversify'; -import { NextApp } from '../nextjs/NextApp'; +import { NextApplication } from '../nextjs/NextApplication'; import "../../common/api/CommonController"; import "../../mother/api/MotherController"; @@ -7,6 +7,6 @@ import "../../mother/notice/api/NoticeController"; export const createContainer = () => { const container = new Container(); - container.bind('NextApp').to(NextApp); + container.bind('NextApp').to(NextApplication); return container; } \ No newline at end of file diff --git a/server/main/common/nextjs/NextApp.ts b/server/main/common/nextjs/NextApplication.ts similarity index 82% rename from server/main/common/nextjs/NextApp.ts rename to server/main/common/nextjs/NextApplication.ts index e31f32d..ebc0bf1 100644 --- a/server/main/common/nextjs/NextApp.ts +++ b/server/main/common/nextjs/NextApplication.ts @@ -6,10 +6,10 @@ const APP = next({ dev: process.env.NODE_ENV !== 'production' }); const preparedApp = APP.prepare(); @injectable() -export class NextApp { +export class NextApplication { public get() { return APP; } - public getPreparedApp() { + public run() { return preparedApp; } } \ No newline at end of file diff --git a/server/main/index.ts b/server/main/index.ts index 4ff72a5..731f538 100644 --- a/server/main/index.ts +++ b/server/main/index.ts @@ -2,15 +2,15 @@ import "reflect-metadata"; import { createApp } from "./common/inversify/createApp"; import { createContainer } from "./common/inversify/createContainer"; -import { NextApp } from "./common/nextjs/NextApp"; +import { NextApplication } from "./common/nextjs/NextApplication"; import { logger } from "./common/utils"; import { errorHandlers } from "./errorHandlers"; const PORT = 3000; -const nextApp = new NextApp(); +const nextApp = new NextApplication(); -nextApp.getPreparedApp().then(() => { +nextApp.run().then(() => { createApp(createContainer(), errorHandlers).listen(PORT); logger.log("info", `server is running on port:${PORT}`); }); \ No newline at end of file diff --git a/server/main/mother/api/MotherController.ts b/server/main/mother/api/MotherController.ts index d1aaa67..6339ae5 100644 --- a/server/main/mother/api/MotherController.ts +++ b/server/main/mother/api/MotherController.ts @@ -1,14 +1,14 @@ import { Request, Response } from "express"; import { inject } from "inversify"; import { controller, httpGet, interfaces, request, response } from "inversify-express-utils"; -import { NextApp } from "server/main/common/nextjs/NextApp"; +import { NextApplication } from "server/main/common/nextjs/NextApplication"; const PATH = "/mother" @controller(PATH) export class MotherController implements interfaces.Controller { - constructor(@inject("NextApp") private nextApp: NextApp) { } + constructor(@inject("NextApp") private nextApp: NextApplication) { } @httpGet("/") public get( diff --git a/server/main/mother/notice/api/NoticeController.ts b/server/main/mother/notice/api/NoticeController.ts index d2fdc9a..16c81d8 100644 --- a/server/main/mother/notice/api/NoticeController.ts +++ b/server/main/mother/notice/api/NoticeController.ts @@ -1,14 +1,14 @@ import { Request, Response } from "express"; import { inject } from "inversify"; import { controller, httpGet, interfaces, request, requestParam, response } from "inversify-express-utils"; -import { NextApp } from "server/main/common/nextjs/NextApp"; +import { NextApplication } from "server/main/common/nextjs/NextApplication"; const PATH = "/mother/notice"; @controller(PATH) export class ImageController implements interfaces.Controller { - constructor(@inject("NextApp") private nextApp: NextApp) { } + constructor(@inject("NextApp") private nextApp: NextApplication) { } @httpGet("/add") public add(