diff --git a/sam-template.yaml b/sam-template.yaml index f5e282c..e5bda45 100644 --- a/sam-template.yaml +++ b/sam-template.yaml @@ -23,7 +23,7 @@ Resources: Properties: Environment: Variables: - NODE_ENV: production + NODE_ENV: staging CodeUri: ./dist PackageType: Zip Runtime: nodejs20.x diff --git a/src/server.ts b/src/server.ts index 303df34..58af315 100644 --- a/src/server.ts +++ b/src/server.ts @@ -53,6 +53,10 @@ class Server { this.express.use(express.urlencoded({ limit: '5mb', extended: true })); if (!isLambda()) this.getProjectVersion(); + + this.routeLevelMiddlewares(); + this.routes(); + this.errorHandlerMiddlewares(); } private getProjectVersion(): void { @@ -121,10 +125,6 @@ class Server { this.server = await this.createServer(); - this.routeLevelMiddlewares(); - this.routes(); - this.errorHandlerMiddlewares(); - if (port) this.PORT = port; this.server.listen(port);