Git Product home page Git Product logo

nodejs-expressjs's Introduction

Boilerplate Project

A boilerplate project created using NodeJs, ExpressJs Framework and PostgreSQL databases.

Getting Started

The Boilerplate contains the minimal implementation required to create a new project. The repository code is preloaded with some basic components like basic app architecture, migrations, Api documentation using swagger and required dependencies to create a new project. By using boiler plate code as standard initializer, we can have same patterns in all the projects that will inherit it. This will also help in reducing setup & development time by allowing you to use same code pattern and avoid re-writing from scratch.

How to Use

Step 1:

Download or clone this repo by using the link below:

https://git.ssasoft.com/musman/nodejs-express.git

Step 2:

Copy .env.sample file into .env file and add replace variables values to the actual environment variables

cp .env.example .env

Step 3:

Go to project root and execute the following command in console to get the required dependencies:

npm install

Step 4:

To run all migrations and seeds execute the following command

npm run migrate

Start Server

npm run dev

Swagger Test RestAPI

Test all rest api, paste the following url in your browser

http://localhost:3002/api/v1/docs/

Postgresql Transaction:

Managed transaction implemented here. To test the transaction use the following endpoint.

http://localhost:3002/post/create

and data should be in following format for transaction.

{
    "post": {
        "title": "Testing 22 Dec",
        "comments": "Ignore these things"
    },
    "postTags": ["Dummy", "Test", "Awesome"]
}

Here association between users, posts and tags has been implemented.

Test Cases using Cypress

To run the test cases you need to run the following command. This will open cypress configuration for e2e tests and from there you can run all the tests.

npm run test

Authentication

For endpoint authentication I have implemented passport, password-local, and password-jwt npm package with jsonwebtoken

Note

All endpoints are secured, please add authorization headers in endpoint.

Features:

  • Swagger
  • Cypress
  • Morgan
  • Cors
  • Sequelize ORM
  • PostgreSQL
  • Hooks
  • Migrations
  • Seeds
  • Sequelize PostgreSQL Transaction
  • passport, passport-local and passport-jwt

Reset Migration:

To reset all migrations execute the following command

npm run migrate:reset

๐Ÿ’ผ Technical Skills

NodeJS Express.js Sequelize Postgres JWT Swagger Jest

nodejs-expressjs's People

Contributors

musmanafzal7 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.