Coder Social home page Coder Social logo

express-basic-api's Introduction

README

Install

Create a Sqlite DB for development

$ sqlite3 test.db

Install and run

npm install
npm start

Running tests

Currently to make sure that your tests doesn’t listen “twice” from the server.js a check is done

if (!module.parent) {
  app.listen(port);
}

Another options is using Nodemon, as a npm package script:

"test": "nodemon --exec \"mocha --recursive\""

JWT

JSON Web Token Claims


Logs

Logs gets written to file from level debug and up in the all-logs.log files under /logs dir. Errors get logged too into errors.log files. Related logic in /core/logger, using Winston.

TODO:

Refs

Libs & Modules


Project structure

├── config                # App configuration files
│  ├─ serviceOne.json     # ServiceOne config
│  └─ ...                 # Other configurations
├── core                  # Business logic implementation
│  ├─ accounts.js
│  ├─ sales.js
│  ├─ comments.js
│  └─ ...                 # Other business logic implementations
├── logs
│  ├─ all-logs.log        # all logs
│  └─ error-logs.log      # error logs
├── prisma                # Prisma ORM
│  ├─ migrations
│  │  ├─ migration_<name>   # Migrations
│  │  └─ migrations_lock.toml # sqlite DB
│  ├─ accounts.js
│  └─ dev.db              # sqlite DB
├── db                    # Data access stuff
│  └─ prisma.js           # DB instantiation
├── routes
│  ├─ controllers         # Request managers
│  ├─ middleware         # Request middleware
│  └─ routes.js           # Define routes here
├── types              # External services implementation
│  ├─ ...
│  └─ common.js                 # Other services
├─ utils                  # Util libs (formats, validation, etc)
├─ tests                  # Testing
├─ scripts                # Standalone scripts for dev uses
├─ pm2.js                 # pm2 init
├─ package.json
├─ README.md
└─ app.js                 # App starting point

HTTP status codes

http-errors

  • 200  OK, The request was successful
  • 201  CREATED, A new resource object was successfully created
  • 404  NOT FOUND, The requested resource could not be found
  • 400 BAD REQUEST, The request was malformed or invalid
  • 500  INTERNAL SERVER ERROR, Unknown server error has occurred

express-basic-api's People

Contributors

auxcoder avatar dependabot[bot] avatar

Watchers

 avatar  avatar

express-basic-api's Issues

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.