Check here
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 devThen visit http://localhost:3000/ (for react app) and http://localhost:3001/ (for node server app)
Detail installation will come as soon as possible :D
npm testComing 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/.envStart the services
docker-compose up -dView the logs
docker-compose logs -fIn 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 iIf 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 testNote that we are overriding the environment variable set in .env file because we don't want our data erased by the tests.
Before commit code, please check files changed with command
./node_modules/.bin/prettier --write ${file_path}.jsor (If you installed prettier as global)
prettier --write ${file_path}.jsExample
./node_modules/.bin/prettier --write client/src/config.jsReference 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