Giter Site home page Giter Site logo

08-rest's Introduction

Build Status

08: Vanilla RESTful API


PR: #2

This HTTP server was created using the native NodeJS http module. The home route URL is: https://vanilla-http-server08.herokuapp.com/ and accepts an optional name query string (?name=name), which will display "Hello" or "Hello Name" if option is added. It will handle GET, POST, PUT and DELETE requests.

In order to run my app, do the following:

1. Click the following link to test the GET request in the browser: https://vanilla-http-server08.herokuapp.com/api/v1/dogs?id=1976

  • Change the id to any number greater than 0 and less that 2018. It will return the number.
  • Change the number outside of the parameters above ex: 2019. It will return a 404 error and write 'not found' in the console.
  • Leave the id query blank. It will return a 400 error and write 'bad request' in the console.

2. Using HTTPie run the following commands in the terminal:

  • echo '{"ID":"","content":""}' | http PUT http://localhost:3002/api/v1/dogs?id=234

  • echo '{"ID":"100","content":"percent"}' | http POST http://localhost:3002/api/v1/dogs?id=100

  • echo '{"ID":"100"}' | http DELETE http://localhost:3002/api/v1/dogs?id=100

08-rest's People

Contributors

jb-tellez avatar lennerblom 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.