@andrewcaires/api
v4.1.4
Published
Simple api for small applications using express, jsonwebtoken, sequelize and websocket
Downloads
253
Maintainers
Readme
API
Simple api for small applications using express, jsonwebtoken, sequelize and websocket
Installation
The module is now available on npm! npm i @andrewcaires/api
Example usage
// .env
NODE_ENV=development
API_DB_TYPE=mariadb
API_DB_DATABASE=database
API_DB_HOST=localhost
API_DB_USERNAME=root
API_DB_PASSWORD=root
API_DB_LOG=false
API_DB_PORT=3306
API_HTTP_PORT=3000
API_HTTP_PUBLIC=/public
API_HTTP_CROSS=true
// API_HTTP_CRT=./ssl/http.crt
// API_HTTP_KEY=./ssl/http.key
// API_TOKEN_CRT=./ssl/token.crt
// API_TOKEN_KEY=./ssl/token.key
API_TOKEN_LIFETIME=1d
API_WEBSOCKET_START=false
// index.ts
import {
Application,
AuthController,
GroupController,
GroupRouteController,
LogsController,
RouteController,
UserController,
UserGroupController,
} from "@andrewcaires/api";
const main = async () => {
const app = new Application(
[
new AuthController,
new GroupController,
new GroupRouteController,
new LogsController,
new RouteController,
new UserController,
new UserGroupController,
]
);
await app.listen();
};
main().catch(console.log);