Skip to content

chrischenyc/fuutr-server

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

About

System Architecture

System Architecture

Overview

This is a Node.js application using ES6 and Express with Code Coverage and JWT Authentication.

Features

Feature Summary
ES6 via Babel ES6 support using Babel.
Authentication via JsonWebToken Supports authentication using jsonwebtoken.
Code Linting JavaScript code linting is done using ESLint - a pluggable linter tool for identifying and reporting on patterns in JavaScript. Uses ESLint with eslint-config-airbnb, which tries to follow the Airbnb JavaScript style guide.
Auto server restart Restart the server using nodemon in real-time anytime an edit is made, with babel compilation and eslint.
ES6 Code Coverage via istanbul Supports code coverage of ES6 code using istanbul and mocha. Code coverage reports are saved in coverage/ directory post yarn test execution. Open coverage/lcov-report/index.html to view coverage report. yarn test also displays code coverage summary on console. Code coverage can also be enforced overall and per file as well, configured via .istanbul.yml
Debugging via debug Instead of inserting and deleting console.log you can replace it with the debug function and just leave it there. You can then selectively debug portions of your code by setting DEBUG env variable. If DEBUG env variable is not set, nothing is displayed to the console.
Promisified Code via bluebird We love promise, don't we ? All our code is promisified and even so our tests via supertest-as-promised.
API parameter validation via express-validation Validate body, params, query, headers and cookies of a request (via middleware) and return a response with errors; if any of the configured validation rules fail. You won't anymore need to make your route handler dirty with such validations.
Pre-commit hooks Runs lint and tests before any commit is made locally, making sure that only tested and quality code is committed
Secure app via helmet Helmet helps secure Express apps by setting various HTTP headers.
CORS support via cors
http-status to set http status code. It is recommended to use httpStatus.INTERNAL_SERVER_ERROR instead of directly using 500 when setting status code.
.editorconfig helps developers define and maintain consistent coding styles between different editors and IDEs.

Getting Started

Install MongoDB database on local machine:

brew install mongodb@4.0.3

Install dependencies:

npm install

Start a local server:

# Start a local server
npm run start

# Start a local server with debug output
npm run start:debug

# verify local server
http://localhost:3000/api/health-check

Docker

Using Docker Compose for Development

# open up a local development system
docker-compose -f "docker-compose.yml" up -d --build
# shut down the local development system
docker-compose -f "docker-compose.yml" down

Deploy

Build Docker images for staging or production

Attach and push Docker image to AWS ECR

Define ECS task

Run ECS task to spawn EC2 instance

Whitelist EC2 instance's IP address on MongoDB Atlas

Re-launch EC2 instance

About

node.js monolith backend for my Lime-like scooter-sharing startup (dead 😡)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published