Package Exports
- @andrewcaires/api
- @andrewcaires/api/dist/index.cjs.js
- @andrewcaires/api/dist/index.esm.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@andrewcaires/api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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=api
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=/ssl/http.crt
API_HTTP_KEY=/ssl/http.key
API_TOKEN_CRT=/ssh/token.crt
API_TOKEN_KEY=/ssh/token.key
API_TOKEN_LIFETIME=3000
API_WEBSOCKET_START=false// index.ts
import {
App,
AuthController,
GroupController,
GroupRouteController,
LogsController,
RouteController,
UserController,
UserGroupController,
} from "@andrewcaires/api";
(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();
})();