Git Product home page Git Product logo

platesapi's Introduction

platesapi

Description

platesapi is a lightweight api with no 3rd party frameworks && redis cloud.

Features

  • No thirdparty frameworks.
  • Redis Cloud DB usage.

Run on Local

Step 1: git clone this repository ertugrulkutluer/platesapi@github

git clone https://github.com/ertugrulkutluer/platesapi

Step 2: download dependencies

npm install

Step 3: run tests

npm test

Step 4: run platesapi

npm start

> [email protected] start /Users/ertugrul/Desktop/plates
> node app.js

Server started on port: 8080

Rest API Document

All endpoints here

  • Get API Rules /api

    {
      "rules": [
              [
                  "Orders under $50 cost $4.95. For orders under $90, delivery costs $2.95. Orders of $90 or more have free delivery."
              ],
              [
                  "Buy one red plate, get the second half price."
              ]
        ],
      "plates": [
          {
              "product": "Red Plate",
              "id": "R01",
              "price": 32.95
          },
          {
              "product": "Green Plate",
              "id": "G01",
              "price": 24.95
          },
          {
              "product": "Blue Plate",
              "id": "B01",
              "price": 7.95
          }
      ]
    }
  • GET /api/plates List of all products

    • Response body:
    [
        {
            "product": "Red Plate",
            "id": "R01",
            "price": 32.95
        },
        {
            "product": "Green Plate",
            "id": "G01",
            "price": 24.95
        },
        {
            "product": "Blue Plate",
            "id": "B01",
            "price": 7.95
        }
    ]
  • GET /api/plates/{{id}} returns a plate

    • Response body:
    {
        "product": "Blue Plate",
        "id": "B01",
        "price": 7.95
    }
  • GET /api/account creates an account & a basket for created account. You will need this account number to add items later.

    • Response body:
    {
      "account_id": "4y4nx",
        "basket": {
            "plates": [],
            "total": 0,
            "delivery_cost": 0,
            "discount": 0
        }
    }
  • GET /api/account/4y4nx/add/R01 adds a plate to specified account

    {
       "plates": [
           "Blue Plate",
           "Blue Plate"
       ],
       "total": "20.85",
       "delivery_cost": "4.95",
       "discount": 0
    }

TODO

  • Readme File
  • ApiDoc
  • Tests
  • Docker Support
  • Deploy (Heroku, aws)

platesapi's People

Contributors

ertugrulkutluer 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.