Table of Contents
We have a store of Asset objects -- Asset types can either be Satellites or Antennas, and they have specified Asset classes that match a corresponding Asset type.
Here are the 3 endpoints for the server with examples of requests you can make:
POST /assets -- creating an Asset NOTE: This endpoint requires form data as the body, ie {"asset_name": "name_here", "asset_type": "satellite", "asset_class": "dove"}
GET /assets -- showcases all the Assets we have
GET /assets/{name} -- showcases the Asset information for a specified Asset name that's the user provides
- Create a Python virtual environment:
python -m venv .venv
source .venv/bin/activate
- Install requirements into virtual environment:
pip install -r requirements.txt
- Start the Flask application:
FLASK_APP=main.py flask run
- Use this link to make requests to the server (Postman suggested):
http://127.0.0.1:5000
Run Pytest with the virtual environment activated:
pytest
If this assignment were in "real life" enterprise work, instead of in memory storing with the dictionary data structure, I would choose to store the information in a database. For example, if you ended an in memory server you'd lose all your information. However, if you have a database with corresponding Flask API servers, you wouldn't lose all your information.
Rebecca Hsieh - [email protected] - therealslimhsiehdy.com