Giter Site home page Giter Site logo

whatsaaaa / starting-template-expressjs-nodejs-typescript Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 552 KB

Starting template for building a RESTful API with ExpressJs, NodeJs & TypeScript

TypeScript 85.64% Shell 1.89% JavaScript 12.47%
nodejs expressjs typescript javascript restful-api template boilerplate boilerplate-template starter-kit starter-template

starting-template-expressjs-nodejs-typescript's Introduction

Expressjs/Nodejs/TypeScript Starting Template

Starting template to build a Node.js RESTful API Service with code written in TypeScript
Inspired by the awesome boilerplate w3rec
Made by @whatsaaaa


> Project Summary

This template should provide you with a ready to develop application with functioning authentication using JWT tokens.

You can find an example controller UserController to see how can you develop new endpoints and database tables.

Also this template will include database seeds and migrations for mysql User table.

> Getting Started

1. Prerequsits

Install Node.js and NPM

Install Yarn

Install MySQL database

If you want a different database, it is possible to change it later.

2. Start new Project

Download this repository on your machine. Configure package.json (change author, project name, project description etc.)

After that copy the .env.example file and rename it to just .env. In this file add your configuration informations such as database connection information.

Now you are ready to setup your application.

yarn run setup

This command will install all dependencies with yarn. After that it will migrate the database and seed some test data into it. When this command is completed your application is ready to use.

3. Serve your App

To start your application locally run next yarn script.

yarn start serve

This will start a local server using nodemon, which will watch for any file changes and will restart the server.

> Scripts

All scripts are defined in the package-scripts.js file. Here we will list the most important and most used ones.

Install

  • Install all dependencies with yarn install.

Linting

  • Run code quality analysis using yarn start lint.

Tests

Run application in dev mode

  • Run yarn start serve to start nodemon with ts-node, to serve the app.

Building the project and run

  • Run yarn start build to generate all JavaScript files from the TypeScript sources.
  • To start the builded app located in dist folder, use yarn start

Database Migration

  • Run typeorm migration:create -n <migration-file-name> to create a new migration file.
  • Migrate your database by running yarn start db.migrate command
  • Revert your latest migration run yarn start db.revert
  • Drop database chema yarn start db.drop

Database Seeding

  • Run yarn start db.seed to seed your seeds into the database


> Features

starting-template-expressjs-nodejs-typescript's People

Contributors

whatsaaaa avatar

Watchers

 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.