# ServerSettings Decorator alias deprecated

Module
import { ServerSettings } from "@tsed/common"
Source/packages/common/src/platform-express/decorators/serverSettings.ts

# Overview

function ServerSettings(settings?: Partial<IModuleOptions>): Function;

# Description

@ServerSettings let you to configure quickly your server via decorator. This decorator take your configuration and merge it with the default server configuration.

The default configuration is as follow:

{
  "rootDir": "path/to/root/project",
  "env": "development",
  "port": 8080,
  "httpsPort": 8000,
  "uploadDir": "${rootDir}/uploads",
  "mount": {
    "/rest": "${rootDir}/controllers/**/*.js"
},
"componentsScan": [
   "${rootDir}/middlewares/**/*.js",
   "${rootDir}/services/**/*.js",
   "${rootDir}/converters/**/*.js"
 ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

You can customize your configuration as follow:

import {ServerLoader, ServerSettings} from "@tsed/common";
import Path = require("path");

@ServerSettings({
    rootDir: Path.resolve(__dirname),
    mount: {
        "/rest": "${rootDir}/controllers/current/**/*.js",
        "/rest/v1": [
          "${rootDir}/controllers/v1/users/*.js",
          "${rootDir}/controllers/v1/groups/*.js"
        ]
    }
})
export class Server extends ServerLoader {

}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17