Code Monkey home page Code Monkey logo

fastapi's Introduction

Python application test with Github Actions

FastAPI

This is a repo demonstrating continuous delivery of a Fast API on AWS (IDS 706 Project 2).

This project demonstrates how to use introductory-level Fast API functions with an already completed API. I modify it slightly by posting an image on the root page, and utilize string formatting to include a variety of user input.

Step 1: Create a new Repository and C9 environment

step1.mp4
  • create a new respository in GitHub
  • create a new C9 environment
  • open the IDE
  • generate new SSH keys
  • clone the repository into the environment
  • navigate into the repository and create python virtual environment
  • create project scaffolding

Step 2: Find an API

step2.mp4

I am using an already completed FastAPI to work off of, which can be found here. It is a horoscope generator that requires a time-frame and zodiac sign as URL inputs.

Step 3: Write Fast API

step3.mp4

See the main.py file.

Step 4: Write Testing File

step4.mp4

See the test_main.py file

configure inbound rules

  • open up AWS EC2
  • go to security groups and select your working environment
  • edit your inbound rules and select "add rule"
  • custom TCP: port range = 8080 and source = 0.0.0.0/0

Step 5: Deploy Github Actions for Automated Testing

step5.mp4
  • set up a new workflow yourself
  • paste in stored text to populate the main.yml file
  • start commit
  • fix any errors until build has passed

(Optional) Step 6: Connect to AWS App Runner

  • create a new service from source code repository
  • connect to Github and specify which repoository to link
  • select python3 runtime
  • build command: "pip install -r requirements.txt"
  • start command: "python main.py"
  • create service name, then create and deploy

Extra Step 7

Future changes to integrate:

  • add custom features such as color, font, images
  • integrate into command line tool that can interact with user and prompt user for input

Sources

  • tapaswenipathak/Horoscope-API link
  • How to insert image file in FastAPI link
  • Noah Gift's FastAPI Code link
  • Sydney Donati Leach's FastAPI instructions link

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.