Giter Site home page Giter Site logo

ravimadan86 / typescript-restful-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from camesine/typescript-restful-starter

0.0 1.0 0.0 232 KB

Node.js + ExpressJS + Joi + Typeorm + Typescript + JWT + ES2015 + Clustering + Tslint + Mocha + Chai

License: MIT License

Shell 2.05% TypeScript 96.27% Dockerfile 1.69%

typescript-restful-starter's Introduction

Typescript-restful-starter

Node.js + ExpressJS + TypeOrm + Typescript + JWT + ES2015 + Clustering + Tslint + Mocha + Chai + Supertest

What use is this Starter App?

  • JWT for protecting routes.
  • Clustering mode for loading many forks depending of the CPU's units.
  • Typeorm for ORM.
  • ES2015 the lastest javascript version has promises and async/await
  • Mocha - Chai for testing
  • Supertest to load the entire server into the tests seamlessly

Structure

/app
	/controllers (Controllers of the app)
	/middlewares (Middlewares for the routes of the app)
	/routes (Routes for Controllers of the app)
	/service (Services for using in any Controller)
	/entity (Models configuration for use)
	/repository (Custom queries)
/config
	/Router.ts (Config file for Routing)
	/Database (DB configuration for use)
	/Server.ts (Server configuration)
config.ts (Config file for the app)
tsconfig.json (File configuration typescript)
tslint.json (File configuration rules typescript)
Index.ts (Main file to start the app)

Install

  1. First clone this repository.

     [email protected]:camesine/Typescript-restful-starter.git
    
  2. Download all dependencies.

     npm install
    
  3. Edit the file ./env and add config database like:

#
# APPLICATION
#
APP_NAME=restful-starter-server
APP_SCHEMA=http
APP_HOST=localhost
APP_PORT=3000

APP_SECRET=HltH3R3


#
# MySQL DATABASE
#
# mysql or mariadb
TYPEORM_CONNECTION=mariadb
TYPEORM_HOST=localhost
TYPEORM_PORT=3306
TYPEORM_USERNAME=root
TYPEORM_PASSWORD=root
TYPEORM_DATABASE=test
TYPEORM_SYNCHRONIZE=true
TYPEORM_LOGGING=error
TYPEORM_LOGGER=advanced-console

#
# PATH STRUCTRUE
#
TYPEORM_ENTITIES=app/models/**/*.ts
TYPEORM_ENTITIES_DIR=app/models

Start App

When execute any of this commands the app start with clustering, creating many cluster apps depending of the numbers of CPU's your computer had.

Development: In Development mode, the express app is started with nodemon for automatic refresh when changes are made.

npm run dev

Test: Run test in development environment

npm test

Production: Run app in production environment

npm start

typescript-restful-starter's People

Contributors

camesine avatar paul75 avatar mandreko avatar krynv avatar bertyhell 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.