From b7b3132eeec4ac011ccfe97c68be570285556572 Mon Sep 17 00:00:00 2001 From: "romain.lenzotti" Date: Tue, 20 Aug 2019 17:47:00 +0200 Subject: [PATCH] fix(common): Deprecate $onMountingMiddleware. Use $beforeRoutesInit instead --- docs/tutorials/aws.md | 23 +++++++++++++++---- .../server/components/ServerLoader.spec.ts | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/tutorials/aws.md b/docs/tutorials/aws.md index 7f0f248f381..68c6fe47f59 100644 --- a/docs/tutorials/aws.md +++ b/docs/tutorials/aws.md @@ -30,16 +30,31 @@ You need to create three files: - One for the local development, for example "index.js" (that you can use to run the app locally with `ts-node local.ts`) Create the server and add the aws middleware: + <<< @/docs/tutorials/snippets/aws/server-configuration.ts Then create the lambda.ts: + <<< @/docs/tutorials/snippets/aws/lambda.ts +And finally create an index.ts to run your server in development mode: ```typescript -// local.js -import {Server} from "./Server.js"; - - +import {$log, ServerLoader} from "@tsed/common"; +import {Server} from "./Server"; + +async function bootstrap() { + try { + $log.debug("Start server..."); + const server = await ServerLoader.bootstrap(Server); + + await server.listen(); + $log.debug("Server initialized"); + } catch (er) { + $log.error(er); + } +} + +bootstrap(); ``` ::: tip You can find a project example with [AWS configurattion here](https://github.com/TypedProject/tsed-example-aws). diff --git a/packages/common/test/server/components/ServerLoader.spec.ts b/packages/common/test/server/components/ServerLoader.spec.ts index 5d6276b4ff0..b1924785997 100644 --- a/packages/common/test/server/components/ServerLoader.spec.ts +++ b/packages/common/test/server/components/ServerLoader.spec.ts @@ -20,6 +20,7 @@ describe("ServerLoader", () => { } $onMountingMiddlewares() { + // deprecated } $afterRoutesInit() {