Code Monkey home page Code Monkey logo

rest-api-workshop-fa22's Introduction

rest-api-workshop-fa21

Required Software

  1. Git
  2. Python >=3.6
  3. Flask
  4. Yarn (optional)
  5. NPM (optional)

Installation and setup

  1. Go to https://www.python.org/downloads/ and download the latest version of Python with pip for your OS.
  2. Go to https://git-scm.org and install the latest version of git

Commands

First, Create a fork of this repo

Then, Clone the forked repo

git clone "https://github.com/your_username_/Project_Name.git" restapi
cd restapi/api

Install the required dependencies and Start the flask server

pip install -r requirements.txt
set FLASK_ENV=development
flask run

Slides

Slides are available here

TO DO

  1. Use this website to check the functionality of your API
  2. Write the 5 HTTP methods in api/app.py
    • get(“/”) - returns a key-value pair, with key "message" and value "Welcome to OSAI" *TIP: Refer to slide 14
    • get(“/all”) - returns events currently stored in the API
    • post(“/event”) - Adds an event to the end of the events dictionary stored in the API * request.json contains the data you add in the form * puts the data into a new key-value pair in events * returns the index in string format
    • put(“/event/<event_id>”) * takes in 1 argument called event_id of int type * adds the data in request.json to events and returns it
    • delete(“/event/<event_id>”) * takes in 1 argument called event_id of int type * deletes the key-value pair with the id passed in * returns a "Deletion Successful" message

rest-api-workshop-fa22's People

Contributors

xuxey avatar faddock avatar innovativeinventor avatar arnavss2 avatar aisair 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.