Welcome to the NBX developer assignment! The goal of this project to get an idea of your coding style. Enjoy!
This is a User Service API. It's purpose is to manage user resources. It should provide JSON endpoints to do this.
-
health:
GET /
- this is just an endpoint that returns the service name. You can hit this once you bring up the service to make sure it's working. -
list users:
GET /users
- return the list of users-
Response Body:
[{ "id": "uuid", "name": "string", "email": "string" }]
-
-
create user:
POST /users
- create a user with the given request payload-
Request Body:
{ "name": "string", "email": "string" }
-
Response Body:
{ "id": "uuid", "name": "string", "email": "string" }
-
-
get user by id:
GET /users/{user_id}
- return the user with the ID from the url, or 404 if not found-
Response Body:
{ "id": "uuid", "name": "string", "email": "string" }
-
-
update a user:
PUT /users/{user_id}
- update the user with the provided ID with the request payload, or 404 if not found-
Request Body:
{ "id": "uuid", "name": "string", "email": "string" }
-
Response Body:
{ "id": "uuid", "name": "string", "email": "string" }
-
-
delete a user:
DELETE /users/{user_id}
- delete the user with the given ID- Response: 204 No Content
- input validation
- unit tests (if you do this, add a section to this README with details on how to run them)
- functional tests (if you do this, add a section to this README with details on how to run them)
- use a database to store user resources
- restructure files to be more maintainable
- UI
- Error handling
- Docker: https://docs.docker.com/install/
From the root directory of the project, run docker-compose build app
From within the project, run docker-compose up -d
This will also run PostgreSQL as the application database.
NOTE:
- Application configuration is supplied via
userservice.yaml
file located underconfig
. This is currently organized into environment specific files likeuserservice-docker.yaml
(for Docker). - If you are running the application from an IDE, run the DB initialization script
init-db.py
before starting the application (also, you could userun-application.sh
).
Running curl http://localhost:8080
should return {"name": "user-service"}
After you've made changes, just run the above two commands again
From the root directory of the project, run docker-compose logs -f app
The API documentation is provided via Swagger and is accessible at - http://localhost:8080/api/doc
- Add tests
- Try finding an alternative to using
wait-for-postgres.sh
; it currently requires PostgreSQL client to be installed on the Docker container. - Add API versioning.