Serva currently accepts 4 configuration values to create an App instance. These options should be able to be overwritten by flags, environment variables, config, and defaults (in that order).
interface ServaConfig {
port: number;
hostname?: string;
extension: string;
methods: string[];
}
1.Flags
$ serva start \
--port 4500 \
--hostname localhost \
--extension ".ts" \
--methods get,post,put,delete,patch
2. Environment
# Port
SERVA_PORT=4500
# Host (ordered in priority)
SERVA_HOSTNAME=localhost
SERVA_HOST=localhost
# Extension (ordered in priority)
SERVA_EXTENSION=".ts"
SERVA_EXT=".ts"
# Methods
SERVA_METHODS="get,post,put,delete,patch"
3. Config file
{
"port": 4500,
"hostname": "localhost",
"extension": ".ts",
"methods": [
"get",
"post",
"put",
"delete",
"patch"
]
}
4. Defaults
const DEFAULT_CONFIG = {
port: 4500,
extension: ".ts",
methods: [
"get",
"post",
"put",
"delete",
"patch"
]
};
Serva currently accepts 4 configuration values to create an App instance. These options should be able to be overwritten by flags, environment variables, config, and defaults (in that order).
1.Flags
$ serva start \ --port 4500 \ --hostname localhost \ --extension ".ts" \ --methods get,post,put,delete,patch2. Environment
3. Config file
{ "port": 4500, "hostname": "localhost", "extension": ".ts", "methods": [ "get", "post", "put", "delete", "patch" ] }4. Defaults