Note:
- There is a sample csv file located at
<rootDir>/backend/sample/sample-keywords.csv
. You can use this one for testing, but any other csv files on your end with the same format should be fine also. - You can signup from the web app UI as well as the API documentation. I am using cookie to store user session, so whether you login on the web app or API, you should be logged in on the other side.
- If you want to run this project on you local machine. Please follow the instructions below.
- NodeJs (>= 10.13.0, except for v13) (Mine is v17.8.0)
- Docker (Docker Desktop recommended)
- VSCode
- Volar
- ... and other recommended extensions listed in
<rootDir>/.vscode/extensions.json
- Open the directory
<rootDir>/backend
in a separate VSCode window to take advantage of ESLint config.
Note: I'm on Mac, so those commands below may not work expectedly on Windows.
- Installation & run
- (optional)
cp .env.development .env.development.local
npm i
npm run dev
- (optional)
- Unit test: (Not fully implemented yet)
npm run test:jest
- End-to-end test: Not implemented yet, probably be using Cypress
- You can do the following steps to test production mode locally with virtual host:
- please add this line
127.0.0.1 gsrs.loi-tra
to your/etc/hosts
(on MacOS) file - run
npm run dev:docker
- This command will also spin up a backend container and a database container as well.
- open http://gsrs.loi-tra on browser to see the production version locally on your machine.
- please add this line
Backend (working directory: <rootDir>/backend
)
(will give "monorepo" a try)
cd <rootDir>/backend
- Installation & run
cp .env.example .env
npm i
- start Docker on your machine
./setup.sh
--> this will check dependencies and set you up with the containers for PostgreSql, Redis and Tornpm run start:dev
- (optional) Seeding data:
npm run db:seed
.
Note: You can play around with the API endpoints via the swagger documentation at http://localhost:3000/api on your local machine, or https://gsrs.loitra.xyz/api/
- Unit test:
npm run test
- this will be automatically run on Github Action on every git push or PR on branch
develop
. You can find the workflow at https://github.com/trathailoi/gsrs-exercise/actions/workflows/unit-test.yml - with coverage
find the coverage at /backend/coverage/lcov-report/index.htmlnpm run test:cov
- this will be automatically run on Github Action on every git push or PR on branch
- Integration test:
this command will spin up a new database dedicated for testing and will be completely terminated after finishing the tests.
npm run test:e2e
build
: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)ci
: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)docs
: Documentation only changesfeat
: A new featurefix
: A bug fixperf
: A code change that improves performancerefactor
: A code change that neither fixes a bug nor adds a featurestyle
: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)test
: Adding missing tests or correcting existing tests,revert
: Revert,wip
: Work in progress, not finished yet