Code Monkey home page Code Monkey logo

ts-node-boilerplate's Introduction

ts-node-boilerplate

NodeJS server boilerplate written in TypeScript.

Features

  • Auto generated swagger documentation.
  • HTTP2 server.
  • Mongo Database.
  • Exception treatment.
  • JWT authentication.
  • Role base API security.
  • Filter endpoint using query and field selection.
  • Integration Tests.
  • Pagination.
  • Log error using log4js.
  • Docker.

Run using Docker

$ npm install --scripts-prepend-node-path=auto
$ docker-compose up --build

Run locally using Npm

$ npm install --scripts-prepend-node-path=auto
$ npm start

Run tests using Npm

$ npm install --scripts-prepend-node-path=auto
$ npm test

Use Node v10.18.0 or bellow. There is a bug on a spdy http2 library for Node 11 and beyond: spdy-http2/handle-thing#13

Usage

After running the app you can access the documentation at: https://localhost:3000/api/doc

If you not set the variable NODE_ENV, the server will set it to 'develop' and will create a user in mongo with following properties: {username:'admin', password:'admin123' roles:['admin']}. The admin user has admin role with access to all endpoints. Without the admin role you can only has permissions to use the endpoints:

  • POST api/v1/authentication/signup
  • POST api/v1/authentication/login
  • GET api/v1/user/me

The admin user can add admin role to other users through:

  • PUT api/v1/user/

ts-node-boilerplate's People

Contributors

leonardocartaxo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.