Giter Site home page Giter Site logo

lotr-restful-api's Introduction

The Lord of the Rings RESTful API

Note: This project is under development.

This project provides a restful interface to search and access data from the novel The Lord of the Rings.

Installing with Docker

Create a .env file:

touch .env

Add your SECRET_KEY to the .env file

SECRET_KEY=your-secret-key

Download and install project dependencies

docker-compose up --build

You can specify the -d switch to start in detached mode. This will bind port 80 and 443. Unfortunately, unlike the docker command, there is no command line arguments to specify ports. If you want to change them, edit the docker-compose.yml file.

After that, start the migration process

docker-compose exec web python manage.py migrate

Database Seeding

Use the build_all() method in the django shell to populate the database

docker-compose exec web python manage.py shell
from data.build import build_all
build_all()

Example

CURL -X GET http://localhost:8000/api/v2/character/?limit=5&offset=5
{
    "count": 15,
    "next": "http://localhost:8000/api/v2/character/?limit=5&offset=10",
    "previous": "http://localhost:8000/api/v2/character/?limit=5",
    "results": [
        {
            "name": "sauron",
            "url": "http://localhost:8000/api/v2/character/6/"
        },
        {
            "name": "boromir",
            "url": "http://localhost:8000/api/v2/character/7/"
        },
        {
            "name": "gimli",
            "url": "http://localhost:8000/api/v2/character/8/"
        },
        {
            "name": "galadriel",
            "url": "http://localhost:8000/api/v2/character/9/"
        },
        {
            "name": "samwise gamgee",
            "url": "http://localhost:8000/api/v2/character/10/"
        }
    ]
}

lotr-restful-api's People

Contributors

gabehenriques avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.