Git Product home page Git Product logo

08-vanilla-rest-api's Introduction

Lab 8-9 Vanilla HTTP server and REST API

Usage

This HTTP server supports several endpoints that will generate meaningful responses to requests. The data used in this example are instances of a Car class, which has properties of make, model, and year.

  • POST to api/car?id={id}

    • A post request to this endpoint which contains all properties of the Car class will create a new instance of a car, including a randomly generated id used to access the data, and write that data to a file.
  • POST to api/car/all

    • A post request to this endpoint which contains any number of instantiated cars will write each car object to its own file.
  • GET from api/car?id={id}

    • A get request to this endpoint with a specified id will retrieve the car object filed under that id. If an id is not given or does not reference an existing car, this will return an error message.
  • GET from api/car/all

    • A get request to this endpoint will retrieve every existing car object and return an array of file names for each object. File names are currently assigned to be the randomly generated id that was created when the object was first created.
  • DELETE from api/car?id={id}

    • A delete request to this endpoint with a specified id will delete the object with this id. If the object does not exist or no id is given, it will return an error.

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.