Git Product home page Git Product logo

restful-api's Introduction

#Making a RESTful API

##Overview

In the past, we used API endpoints provided by iTunes and OMDB. These APIs provide a search interface where we can submit queries and get responses. Since these responses are returned as JSON instead of HTML, we can easily incorporate these APIs into our applications.

Modern web development revolves around creating APIs for this purpose. However, there's some additional purposes, such as being able to use the server application with multiple clients. In Rails and Express, we assumed that our only client was a web browser. In reality, today's IOT (Internet of Things) provides the potential for unlimited clients, meaning we can't just send HTML to every client.

API

By providing a RESTful API and sending data using a specific format (JSON), we can incorporate our server into multiple different applications.

Why introduce this? We'll find that these concepts fit right into Angular.JS.

##Requirements

  • Create a RESTful API using Express, Mongoose, and JWT for authentication
  • Do not incorporate any HTML or EJS templates, with the exception of the home page. Your API will provide the endpoints listed at the bottom.

###Pair Programming

If you'd like, feel free to practice pair programming on this assignment. Definition:

Pair programming consists of two programmers sharing a single workstation (one screen, keyboard and mouse among the pair). The programmer at the keyboard is usually called the "driver", the other, also actively involved in the programming task but focusing more on overall direction is the "navigator"; it is expected that the programmers swap roles every few minutes or so. See more at: http://guide.agilealliance.org/guide/pairing.html#sthash.xsWVt7Ee.dpuf

###API Endpoints (Minimum)

  • Homepage (optional)
    • GET /
      • display a nice welcome page to your API, and maybe include instructions on how to use it
  • User
    • GET /api/users
      • display all users
    • POST /api/users
      • create a new user
  • Authentication
    • POST /api/auth
      • ask and receive a JWT token
  • Coffee (you can also use a different model/attributes if you wish. This model should require authentication)
    • GET /api/coffees
      • display all coffees
    • POST /api/coffees
      • create a new coffee
    • GET /api/coffees/:id
      • display a specific coffee
    • PUT /api/coffees/:id
      • edit a specific coffee
    • DELETE /api/coffees/:id
      • delete a specific coffee

###Attributes for the Coffee model

  • Name
  • Size
  • Shots
  • Type of milk

###Bonus

  • Add tests to your API using Mocha/Chai.
  • Add an AngularJS application that consumes this API.

Licensing

  1. All content is licensed under a CC-BY-NC-SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

restful-api's People

Contributors

bhague1281 avatar

Watchers

 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.