This is a simple FastAPI project for managing achievements, projects, skills, and events. It provides endpoints to upload and retrieve data related to these categories. The data is stored in a JSON file website.json
.
Client: HTML, SCSS, JAVASCRIPT
Server: FASTAPI, PYTHON
- Creates a FastAPI app instance using FastAPI().
- Adds Cross-Origin Resource Sharing (CORS) middleware to the app using
add_middleware
. - Allows all origins, credentials, methods, and headers for simplicity.
- Defines an asynchronous function
load_json()
to load data from a JSON file(website.json)
.
- Endpoint: ``/
- Method:
POST
- Returns a welcome message.
- Endpoint:
/achievements/
- Method:
POST
- Parameters:
header
,description
,image
,url (form parameters)
- Uploads achievement data to
website.json
.
- Endpoint:
/projects/
- Method:
POST
- Parameters:
header
,description
,image
,url (form parameters)
- Uploads project data to
website.json
.
- Endpoint:
/skills/
- Method:
POST
- Parameters:
percentage
,name
,image
,url (form parameters)
- Uploads skill data to
website.json
.
- Endpoint:
/events/
- Method:
POST
- Parameters:
description
,organization
,image
,url(form parameters)
- Uploads event data to
website.json
.
- Endpoint:
/content/{prompt}
- Method:
GET
- Parameters:
prompt
(path parameter) - Retrieves content from
website.json
based on the specified categoryprompt
.
- Endpoint:
/delete/{prompt}/{id}
- Method:
GET
- Parameters:
prompt
,id
(path parameters) - Deletes content from
website.json
based on the specified category prompt and content ID.
- Includes commented-out code for retrieving images and deleting content. The code seems to be using os and FileResponse, but these parts are commented.
POST apikey/achievements/
Endpoint | Method | Parameters |
---|---|---|
/achievements/ |
POST |
header : Achievement header (string, form) |
Description : Uploads achievement data and saves it to website.json. Returns the updated JSON data.
POST apikey/projects/
Endpoint | Method | Parameters |
---|---|---|
/skills/ |
POST |
header : Project header (string, form) |
Description : Uploads Project data and saves it to website.json. Returns the updated JSON data.
POST apikey/skills/
Endpoint | Method | Parameters |
---|---|---|
/skills/ |
POST |
percentage : Skill proficiency percentage (float, form) |
Description : Uploads skills data and saves it to website.json. Returns the updated JSON data.
POST apikey/events/
Endpoint | Method | Parameters |
---|---|---|
/events/ |
POST |
description : Event description (string, form) |
Description : Uploads events data and saves it to website.json. Returns the updated JSON data.
GET apikey/content/{prompt}
Endpoint | Method | Parameters |
---|---|---|
/content/{prompt} |
GET |
prompt : Category prompt (string, path) |
Description : Retrieves content from website.json based on the specified category prompt.
GET apikey/delete/{prompt}/{id}
Endpoint | Method | Parameters |
---|---|---|
/achievements/ |
GET |
prompt : Category prompt (string, path) |
Description : Deletes content from website.json based on the specified category prompt and content ID. Returns a status message.
Install the required dependencies using the following command:
pip install fastapi[all] uvicorn
Run the application using the following command:
uvicorn your_app_name:app --reload
Replace your_app_name with the name of the Python file containing your FastAPI app.
If you have any feedback, please reach out to us at colddsam@gmail.com