Coder Social home page Coder Social logo

express-rest-app's Introduction

Table of Contents

Short Description

The objective of the project is to create a basic Express backend exposing a REST API

Project Dependencies

Development and production dependencies:

  "scripts": {
    "start": "node --require 'babel-register' src/index.js",
    "lint": "standard 'src/**/*.js'",
    "build": "babel src -d dist",
    "watch": "nodemon",
    "test": "NODE_ENV=test mocha --compilers js:babel-register --timeout 10000 tests/"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-register": "^6.26.0",
    "mocha": "^5.0.4",
    "nodemon": "^1.14.12",
    "pm2": "^2.10.1",
    "supertest": "^3.0.0"
  },
  "dependencies": {
    "body-parser": "^1.18.2",
    "cors": "^2.8.4",
    "dotenv": "^5.0.1",
    "express": "^4.16.3",
    "jwt-simple": "^0.5.1",
    "morgan": "^1.9.0",
    "ws": "^5.0.0"
  }

Api development using Postman

Securization with token using jwt-simple

Testing

npm install --save-dev supertest mocha

Project Structure

express-rest-app
    |- node_modules
        ...

    .gitignore
    package-lock.json
    package.json
    README.md

Available Scripts

In the project directory, you can run:

npm run start

Runs the app in the development mode. Open http://localhost:9000 to view it in the browser.

npm run watch

Runs the app with nodemon. Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.

npm run test

Note that the development server must be stopped to run the tests.

npm run build

Transpile the code to the configured node version. From the 'src' folder to the 'dist' folder.

pm2 start dist/index.js

pm2 monit

Monitoring the node server with pm2.

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.