/jx-django-api

Django rest api blueprint

Primary LanguagePython

A generic blueprint project for Django Rest Framework WIP

Tech/framework used

Built with

Uses docker and docker-compose

https://docs.docker.com/get-docker/

You have to setup your environment variables at .env.dev in the project root

Quickstart

First clone the git repo or download it.

Time to build the images

At the project's root folder

The argument "--env-file .env.dev " will inject the environment variables into container

Run Atached to the console

$ docker-compose --env-file .env.dev up

Run Detached from console

$ docker-compose --env-file .env.dev up -d

To stop if attached

ctrl+c to stop the process

To stop if detached

$ docker-compose down

Endpoints:

  • /api/posts

    • Allow: GET, POST
    • Content-Type: application/json
    • Also Django Rest Framework Interface
    • payload for POST
    {
       "title": "What Stuff",
       "url": "https://margot.net"
    }
  • /api/posts/[int:id]

    • Allow: GET, PUT, PATCH, DELETE
    • Content-Type: application/json
    • payload required only for PATCH or PUT
    • payload
    {
       "title": "What Stuff",
       "url": "https://margot.net"
    }
  • /api/posts/[int:id]/vote

    • Allow: POST, DELETE
    • Content-Type: application/json
    • DELETE returns code 204 no response
    • no payload required
  • /api/auth/signup

    • Allow: POST
    • Content-Type: application/json
    • Returns token
    • payload
    {
       "username":"joao",
       "password":"secret"
    }
  • /auth/login

    • Allow: POST
    • Content-Type: application/json
    • Returns token
    • payload
    {
       "username":"joao",
       "password":"secret"
    }

PS: Still work in progress