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.example
to.env
and then set the key based on need -
To run the application for development purposes
node app
ornpm start
ornodemon
This will start the application on
127.0.0.1:8432
or please check your .env fileThe
Nodemon
will 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_NAME
same asDB_TESTING_NAME
because the server will get the data from
DB_NAME
while the test case will insert toDB_TESTING_NAME
and 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