Skip to content

abunuwas/manning-api-conf-2021

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Manning API Conference 2021

API development workflows for successful integrations

Author: Jose Haro Peralta

image image

Full stack consultant; co-founder of microapis.io

How to work with this repo

This repo provides examples for my talk at Manning's API conference 2021, titled "API development worksflows for successful integrations". The code includes the implementation of a simple TODO REST API in Python, using the popular FastAPI framework. The specification for the API is included under the oas.yaml file. To set up the environment required to run the code in this repo, make sure you have:

  • Python 3.9 together with pipenv
  • node.js version 12 or higher

To install the dependencies, run the following commands:

$ pipenv install --dev
$ yarn

This will install the Python dependencies required to run and test the app, as well as the npm dependencies that we use for furhter testing and for server mocking.

To activate the Python environment, run the following command:

$ pipenv shell

Now you can run the TODO API with the following command:

$ uvicorn todo.server:server

To run the Dredd test suite, run the following command:

$ ./node_modules/.bin/dredd oas.yaml http://127.0.0.1:8000 --server "uvicorn todo.server:app" --hookfiles=./hooks.py --language=python 

To run the schemathesis test suite, run the following command, while running the FastAPI server with the uvicorn command show earlier (uvicorn todo.server:server):

$ schemathesis run oas.yaml --base-url=http://localhost:8000 --stateful=links

If you wish to set up your own Travis CI server to test this code, make sure you create a Heroku app with a valid name, include the name of the app in the deployment file, and run the following command to encrypt your deployment key:

$ travis --encrypt $(heroku auth:token) --add deploy.api_key --pro

About

Repository with examples for Manning's API conference 2021

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages