Skip to content

nhitt-1337/sun-chat-nodejs

 
 

Repository files navigation

sun-chat-nodejs

Install

Install mongoDB

Check here

Install project

git clone git@github.com:framgia/sun-chat-nodejs.git
npm run setup # To install npm for node and react client
cp .env.example .env
npm run dev

Then visit http://localhost:3000/ (for react app) and http://localhost:3001/ (for node server app)

Detail installation will come as soon as possible :D

Tests

npm test

Docker

Coming soon. Currently not working well

You can also use docker for development. Make sure you run npm install on your host machine so that code linting and everything works fine.

npm i
cp .env.example .env
cp client/.env.example client/.env

Start the services

docker-compose up -d

View the logs

docker-compose logs -f

In case you install a npm module while developing, it should also be installed within docker container, to do this first install the module you want with simple npm i module name, then run it within docker container

docker-compose exec node npm i

If you make any changes to the file, nodemon should automatically pick up and restart within docker (you can see this in the logs)

To run tests

docker-compose exec -e MONGODB_URL=mongodb://mongo:27017/noobjs_test node npm test

Note that we are overriding the environment variable set in .env file because we don't want our data erased by the tests.

Prettier

Before commit code, please check files changed with command

./node_modules/.bin/prettier --write ${file_path}.js

or (If you installed prettier as global)

prettier --write ${file_path}.js

Example

./node_modules/.bin/prettier --write client/src/config.js

Reference link: https://prettier.io/docs/en/cli.html#check

Highly recommend:
Let's use extensions for editor. It can auto check when you saved file https://prettier.io/docs/en/editors.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 90.5%
  • HTML 4.1%
  • CSS 3.9%
  • Shell 1.4%
  • Dockerfile 0.1%