Code Monkey home page Code Monkey logo

papi-starter's Introduction

Pointhub API Starter

Features

  • Compression Using gzip compression with Compression
  • CORS Cross-Origin Resource-Sharing enabled using Cors
  • Environment Variable using dotenv
  • Secure HTTP Headers using Helmet

Development Stack

Services

Directory Structure

PAPI-STARTER
├── build
├── coverage
├── node_modules
├── src
│   ├── assets
│   ├── config
│   ├── database
│   ├── middleware
│   ├── modules
│   │   └── example
│   │       ├── controller
│   │       ├── model
│   │       ├── use-case
│   │       ├── validation
│   │       └── router.ts
│   ├── services
│   └── test
│       ├── setup.ts
│       ├── teardown.ts
│       └── utils.ts
├── .env
├── .env.example
├── .env.text
├── .env.test.example
└── README.md

Contribution Guide


Database for development

Since transactions are built on concepts of logical sessions they require mechanics which are only available in a replica set environment.

Choose one of the options that you prefer

Installation

If you are using docker for installation, currently we cannot connect it to the local MongoDB database. So you should use an online database for development

With Docker

You still need to install dependencies locally to enable development features like eslint, prettier, and test.

cp .env.example .env
cp .env.test.example .env.test
npm install
docker-compose up

Without Docker

cp .env.example .env
cp .env.test.example .env.test
npm install
npm run dev

Setup Database

Add Validation Schema

node cli db:init

Seed Default Database

node cli db:seed

Testing

Setup Database Schema

node cli db:init --db-name="starterTestDB"

Testing all test case

npm run test

Testing specific file or folder

# Test specific file
npm run test -- src/modules/example/controller/create.spec

# Test specific folder
npm run test -- src/modules/example/controller

# Test example module
npm run test -- src/modules/example

(Optional) Running test from docker

  1. Check running container
docker ps
CONTAINER ID   IMAGE              COMMAND                  CREATED             STATUS                PORTS                                 NAMES
902293b368b3   papi-starter-api   "docker-entrypoint.s…"   About an hour ago   Up 11 minutes         0.0.0.0:3000->3000/tcp
  1. Access docker container using CONTAINER ID above
docker exec -it 902293b368b3 bash
  1. Run test inside docker container
node@902293b368b3:~/app$ npm run test

Deployment

docker build -t pointhub/papi-starter .

papi-starter's People

Contributors

martiendt avatar goen94 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.