@andrewcaires/api
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

npm downloads size license

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);

Links

License

Package Sidebar

Install

npm i @andrewcaires/api

Weekly Downloads

8

Version

3.1.0

License

MIT

Unpacked Size

103 kB

Total Files

6

Last publish

Collaborators

  • andrewcaires