This is a base structure for Node JS application
-
Install node
-
Install redis
-
Install Database mysql
-
Clone this repository
-
To install the package on package.json just run
npm install -
Copy
.env.exampleto.envand then set the key based on need -
To run the application for development purposes
node appornpm startornodemonThis will start the application on
127.0.0.1:8432or please check your .env fileThe
Nodemonwill automatically restart the server, so you don't need to restart the server manually.
Running a test is easy.
-
Set your .env variable of
DB_NAMEsame asDB_TESTING_NAMEbecause the server will get the data from
DB_NAMEwhile the test case will insert toDB_TESTING_NAMEand will cause your test case FAILED -
Make sure you already run development server and the next step is
-
Run
npm test
To run on production environment please don't use node app or npm start
because when something went wrong, your app will stop and it will be a down time for you project.
To make the application available or at least nearly zero down time, please use another package
to make the app running all the time or at least restart when something went wrong.
- Writing tests
- Code review
- Other guidelines
- Repo owner or admin
- Other community or team contact