This project is my implementation of Nesto technical assessment.
📌 You can find the assessment instructions here.
-
Install node version manager (nvm) from here (if not already installed)
-
Run following commands to setup node version
nvm install v20.18.0 nvm use
-
Install dependencies
npm install
-
Start typescript compiler and run service
In order to watch for changes and run the application locally you have to run the TypeScript compiler in watch mode in addition to any/all the required entry points.
npm run ts:watch # Terminal 1 npm run app:dev # Terminal 2
-
Your server should be running at http://localhost:5001
-
Ensure that the containers are up and running
docker-compose up -d
-
Move to /service directory
cd service
-
Migrate the test database schema
./test/database/migrate-test.sh
-
Run tests
npm run test
- .nvmrc .npmrc files missing, its better to have to maintain consistency
- package.json missing engines.node, its better to have to maintain consistency
- Using really old node version! :(
- Add paging support to all routes
- Define max number of authors and genres (I believe pg has a 65535 as default max allowed number of parameters)
- Enable auto increment on PKs in database tables
- GET /authors should have a
search
query parameter, I added it in my implementation but it is missing in the api spec - For reliability, I would also enable log_duration on psql, push logs to the log management tool, and analyze query execution times
- Create index on author first_name and last_name to help with search
- I am using the npm pg library for communicating with the database, it can be replaced with sequelize or other ORM for ease.
- I only wrote e2e tests for my routes. My tests are covering all cases and since there is not much happening inside the services or controllers, I don't see a reason to test them individually
- All my data logic is inside services, the reason for that being if in future the database is changed, there would be only changes required in the services.