Giter Club home page Giter Club logo

people-api's Introduction

people-api

Hello ๐Ÿ‘‹๐Ÿป,

This is a REST API with that simulates a simple people record database. Post following the setup instructions, you may want to play around with the API's in either swagger or with the provided postman collections in /postman folder. Enjoy and happy testing.

Tech stack

Uses Flask, Connexion, Swagger and SQL Alchemy

Setup

  • Ensure you have pipenv available. Read this blog to understand all about pipenv
  • Ensure you have cloned this repo and are in the project root directory that has the Pipfile with definitions of all required dependencies.
  • Execute pipenv shell to activate the virtualenv in your terminal
  • Execute pipenv install to install all dependencies
  • cd to people-api
  • Execute python server.py
  • To open swagger navigate to http://0.0.0.0:5000/api/ui/

On a windows machine, you may want to replace the host as 127.0.0.1 in above URL

Project structure

  • server.py has the code to start the Flask app with connexion
  • people.py has the implementation for CRUD operations of the people API
  • swagger.yml has the swagger spec to define the route for the API while also allowing to build out a nice swagger documentation
  • static dir contains the css and js files (following MVC) which define the presentation and the interactions with the web apps API

Common Gotchas

  • To install swagger-ui, please run pipenv install "connexion[swagger-ui]". Read this bug to understand about why zsh needs this to be quoted.
  • If you are on windows platform,
    • Try using 127.0.0.1 as the host instead of 0.0.0.0
    • Also enclose the URL in CURL with double quotes instead of single quotes (Reference thread on stack overflow)

Reference

This follows the steps from a real python tutorial series written by Doug Farrell

Further read

Some useful posts to refer apart from the tutorials

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.