-
Clone this repository to the destination folder
-
Load Postman with
News Provider.postman_collection.json
-
Running:
3.a For development, run docker-composer with:
sudo docker-composer up --build -d
3.b For production, use this one instead:
sudo docker-composer -f docker-composer.prod.yml up --build -d
-
If necessary, run migrations and createsuperuser:
sudo docker-compose exec web python manage.py migrate
sudo docker-compose exec web python manage.py createsuperuser
-
Access the api through http://localhost/api/
Challenge goal: The purpose of this challenge is to give an overall understanding of a backend application. You’ll be implementing a simplified version of a news provider API. The concepts that you’re going to apply are:
- REST architecture;
- Authentication and permissions;
- Data modeling and migrations;
- PostgreSQL database;
- Query optimization;
- Serialization;
- Production builds (using Docker).
Target level: This is an all around challenge that cover both juniors and experience devs based on the depth of how the concepts were applied.
Final accomplishment: By the end of this challenge you’ll have a production ready API.
- Clear instructions on how to run the application in development mode
- Clear instructions on how to run the application in a Docker container for production
- A good API documentation or collection
- Login API:
/api/login/
- Sign-up API:
/api/sign-up/
- Administrator restricted APIs:
- CRUD
/api/admin/authors/
- CRUD
/api/admin/articles/
- CRUD
- List article endpoint
/api/articles/?category=:slug
with the following response:
[
{
"id": "39df53da-542a-3518-9c19-3568e21644fe",
"author": {
"id": "2d460e48-a4fa-370b-a2d0-79f2f601988c",
"name": "Author Name",
"picture": "https://picture.url"
},
"category": "Category",
"title": "Article title",
"summary": "This is a summary of the article"
},
...
]
-
Article detail endpoint
/api/articles/:id/
with different responses for anonymous and logged users:Anonymous
{ "id": "39df53da-542a-3518-9c19-3568e21644fe", "author": { "id": "2d460e48-a4fa-370b-a2d0-79f2f601988c", "name": "Author Name", "picture": "https://picture.url" }, "category": "Category", "title": "Article title", "summary": "This is a summary of the article", "firstParagraph": "<p>This is the first paragraph of this article</p>" }
Logged user
{ "id": "39df53da-542a-3518-9c19-3568e21644fe", "author": { "id": "2d460e48-a4fa-370b-a2d0-79f2f601988c", "name": "Author Name", "picture": "https://picture.url" }, "category": "Category", "title": "Article title", "summary": "This is a summary of the article", "firstParagraph": "<p>This is the first paragraph of this article</p>", "body": "<div><p>Second paragraph</p><p>Third paragraph</p></div>" }