ZzoNe322 / express-boilerplate-js

Boilerplate for express web server in JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-boilerplate-js

Boilerplate for express web server in JS.

How to use

Setup

  • install Node.js (ver. 8 or higher) and npm from https://nodejs.org/
  • git clone
  • cd express-boilerplate-js
  • npm i
  • add .env file with env variables like in env.example or just rename .env.exapmle -> .env
  • npm start

You will see this message:

XXXX-XX-XX XX:XX:XX [info]: Server is listening on port 3000

Congratulations! It works.

Feel free to access 127.0.0.1:3000 through browser/Postman to get greeting message form server.

You can also test POST request - pass your name in request body. Check validation model in src/validation/models/post.joi.js

Testing

You can run tests (with help of Jest) with command

  • npm run test

Some pre-build boilerplate tests will execute. You can find them in __test__ directory in project.

Also, you can manually run eslint test with command

  • npm run test:lint

Features

This boilerplate using:

FAQ

Q: Why another boring boilerplate?

A: Main idea is to create CLI for bootstrapping new project. Up-to-date boilerplates is a first step to this.

Q: Why no Typescript?

A: Typescript coming soon, it will be in separate repo or at CLI.

Q: Why ... [Winston/Jest/Husky]?

A: For now we use our common stack. We will try to make replacing one library with another as easy as possible (and we will add some choices for CLI).

Contribution

While CONTRIBUTING.md still in progress feel free to make merge request, open some issues or contact me directly. Thanks!

About

Boilerplate for express web server in JS

License:MIT License


Languages

Language:JavaScript 100.0%