Giter VIP home page Giter VIP logo

drf_api_example's Introduction

DRF_api_example

REST API example for Pizza Order Demo.

Requirements

  1. Python v2.7.10
  2. postgreSQL
  3. virtualenv

Running locally

In order to run DRF_api_example, please install postgreSQL and both the Python runtime and development environments. The following instructions should apply to computers running a version of the Linux or OS X operating systems.

  1. Download the DRF_api_example code by running git clone https://github.com/jahandaniyal/DRF_api_example.git
  2. Visit the DRF_api_example directory: cd DRF_api_example
  3. Create a virtual environment for the project: virtualenv venv
  4. Start using the virtual environment: source venv/bin/activate
  5. In /api_example/settings.py file, change the postgres user credentials:
 DATABASES = {
   'default': {
     'ENGINE': 'django.db.backends.postgresql_psycopg2',
     'NAME': 'api_example_db',
     'USER': 'postgres',
     'PASSWORD': '123',
     'HOST': 'localhost',
     'PORT': '5432'
   }
 }
  1. Install all requirements: pip install -r requirements.txt
  2. Finally, start the Django server: python manage.py runserver 127.0.0.1:8080
  3. Visit http://127.0.0.1:8080/orders/

REST API Details

The following operations are supported -

  • Create a new Order
  • Get all orders created by the customers
  • Get a specific order
  • Update an Order
  • Delete an Order

TESTS

Tests has been included in orders/tests.py for the following cases -

  • Create a new Order
  • Get records of order created by customers
  • Update an order
  • Partial update of an order e.g only changing customer address
  • Deleting a order

drf_api_example's People

Contributors

jahandaniyal avatar

Watchers

James Cloos avatar  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.