Skip to content

Commit

Permalink
Initial creation (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Li-Nathaniel authored Mar 30, 2024
1 parent 75708f9 commit 4c060e6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions api_template/Data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder is optional but if you have any data (eg. CSV) files that are needed, you should store them here in one folder
7 changes: 7 additions & 0 deletions api_template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# API Template (Flask)

This is a template you can use/follow to make a simple Flask Microservice. It may need adjusting based on your needs.

Simply put, you should be able to use this template by importing your original python file and modifying the other files/folders to setup the API endpoints.

For more guidance, you can also refer to the ETA API for more guidance as that follows a very similar format.
1 change: 1 addition & 0 deletions api_template/Schemas/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This Schemas folder should contain any SQL queries needed to setup your table so that it can receive data
13 changes: 13 additions & 0 deletions api_template/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file will be heavily dependent on your service but some general steps are detailed below

# Ensure that any dependencies (eg. libraries, packages, files, DB) are accounted for here

# Retrieve environment variables (ie. DB credentials) and connect to your DB

# Write your API methods/endpoints below as needed (this should take care of pulling data and writing it as needed through the use of JSON data)

# Your API method can most likely pull the necessary data, feed it into your logic/other python file (eg. for the ETA API, it feeds the data into the eta.py file, and execute the appropriate methods

# Below is the code needed to start running your microservice -> The code below will run your microservice locally on port 6000 (change as necessary if it's already taken)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=6000)
1 change: 1 addition & 0 deletions api_template/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file is pretty straightforward, make sure to have all required packages/libraries included here for setup/dependency purposes.

0 comments on commit 4c060e6

Please sign in to comment.