- Docker with docker compose
Start application using docker compose
docker compose upafter application startup
docker compose exec -T db mysql -uroot -ppassword task <db-data.sqlDatabase is filled with users and locations, you don't need to write CRUD operations for those. This template can be changed in any desired way needed to finish tasks.
As your task please do the following things:
-
Create following endpoints
- POST /auth/login - should generate jwt token, don't play with hasing passwords, just plain string comaprison
- GET /locations - verify user and return list of cities
- POST /location/:id/favorite - verify user and add city to favorites for given user
- GET /weather - fetch and return weather for user favorited cities, you can use any weather api you want, eg. https://openweathermap.org/api
-
We preffer to see correctly committed code, we will be very sad to see whole task commited as one commit.
-
Please shortly explain why your code is easily testable. You can use an example for this.
-
Add es-lint rules and some form of forcing them in code. Why have you decided to implement such rules and why have you chosen such form of enforcing them?
-
(Optional) Add possibility to start application in dev(local) mode. In such mode app should not request open weather api for weather but should use some mocked data, stored locally. Please describe idea behind this implementation.
-
(Optional) Store weather in our database. App should request for weather once every hour and store it in database. Weather returned to user should be fetched from this table. This operation should not be handled by main application thread. It might be child process, worker etc. however, we want the code of origial weather fetch to be reused in this solution. Please move this solution to separate branch. Please, also describe shortly why you have implemented it like this.