viniciosbarretos / django-crud

Simple Django Application - CRUD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to codeleap πŸ‘‹

Version License: MIT

This is a small Django project to demonstrate Django CRUD functionality. The main app is an API created using Django Rest Framework.

🏠 Live API

Requirements

Docker Compose

Install

Codeleap is deployed using Docker Compose. Edit the script to configure the environment variables to fit your requirements.

# clone repository
git clone https://github.com/viniciosbarretos/codeleap.git

# change directory to repo
cd codeleap

# start the container using the docker-compose command
sudo docker-compose up

Usage

To access the application go to the URL defined at docker-compose.yml. The default URL is http://localhost:80/

Create Post

POST http://{{ domain }} /
// request body
{
    "username": "@Sample User",
    "title": "Lorem Ipsum",
    "content": "Dolor Sit Amet"
}

Get a list of Posts

GET http://{{ domain }} /

Get individual Post

GET http://{{ domain }} /{OBJECT_ID}/

Update a Post

PATCH http://{{ domain }} /{OBJECT_ID}/
// request body
{
    "title": "Lorem Ipsum",
    "content": "Dolor Sit Amet"
}

Delete a Post

DELETE http://{{ domain }} /{OBJECT_ID}/
// request body
{}

API Validators

  • All usernames should start with @
  • Once set, you can't change username
  • You can't set/change object ID and creation datetime

CORS Policy

By default, all cors requests are blocked, except from https://dev.codeleap.co.uk/.

Run tests

docker-compose run app-django python manage.py test

To do

  • SSL / certbot (domain name needed)
  • API results pagination
    • If this were implemented, the front end would not work correctly. I followed documentation guidelines.

Author

πŸ‘€ Vinicios Barretos

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2020 Vinicios Barretos.
This project is [MIT] licensed.


_This README was generated with ❀️ by readme-md-generator

About

Simple Django Application - CRUD

License:MIT License


Languages

Language:Python 92.1%Language:Dockerfile 4.5%Language:Shell 3.4%