Package Exports
- @andrewcaires/api
- @andrewcaires/api/package.json
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=
API_DB_LOG=false
API_DB_PORT=3306
API_HTTP_PORT=3000
API_HTTP_PUBLIC=/public
API_HTTP_CROSS=true
API_HTTP_CRT=http.crt
API_HTTP_KEY=http.key
API_TOKEN_CRT=token.crt
API_TOKEN_KEY=token.key
API_TOKEN_LIFETIME=3000
API_WEBSOCKET_START=false// index.ts
import {
App,
AuthController,
GroupController,
GroupRouteController,
LogsController,
RouteController,
UserController,
UserGroupController,
} from "@andrewcaires/api";
const main = async () => {
const app = new App(
[
new AuthController("/auth"),
new GroupController("/groups"),
new GroupRouteController("/groups"),
new LogsController("/logs"),
new RouteController("/routes"),
new UserController("/users"),
new UserGroupController("/users"),
]
);
await app.listen();
};
main().catch(console.log);