API Configs
ts
import { LogLevels, IApplicationConfig } from "axe-api";
const config: IApplicationConfig = {
prefix: "api",
env: process.env.NODE_ENV || "production",
port: process.env.APP_PORT ? parseInt(process.env.APP_PORT) : 3000,
logLevel: LogLevels.INFO,
database: {
...
},
};
export default config;
prefix
prefix
is the default API prefix that will be used in all routes.
bash
GET /api/v1/users/:userId/posts/:id
Suggestions;
- It should be a string
- Do not use numbers
- You are allowed to keep it empty.
env
env
means which environment your API will work.
Some examples; are development
, testing
, staging
, and production
.
Suggestions;
- Using environment variables is suggested
- You SHOULD use
production
for the production environment to protect sensitive data.
port
port
means in which port the application will run. You can select any port that is available for your setup.
logLevel
logLevel
determines what kind of logs will be put into the terminal.
Possible values;
NONE
ERROR
WARNING
INFO
ALL
TIP
Error and warning logs would be shown at the same time if you select WARNING.