Skip to content

Conversation

JordanChen123
Copy link
Contributor

@JordanChen123 JordanChen123 commented Feb 3, 2025

Description

Changes allows the website to handle incoming POST requests.

  • Note that for generic sensors, JSON format does not support BigInt format, so the current implementation converts any BigInt values to strings before storing them in the database. This ensures compatibility when handling sensor data while preserving precision.
  • Final implementation done for globalpath, gps, and localpath. Will finalize the api code for the rest of the data types once the functionality is verified.
  • For those in Pathfinding that want to use the website as a visualizer to visualize local path data, switch to the post_request_handling branch, then in the vscode terminal, use curl commands. Examples are in the resource section.

Verification

  • Example of the website showing globalpath data that I posted to the website.

image

Resources

  • Note that the website only shows one local path between two waypoints at a time. So if you would like to visualize the entire path (like how I have done in the image above), you should post to the globalpath API.

Examples:

POST Request - Sending a Single Global Path

curl -X POST "http://localhost:3005/api/globalpath" \
-H "Content-Type: application/json" \
-d '{ "waypoints": [ { "latitude": 49.3761, "longitude": -123.2737 }, { "latitude": 49.3771, "longitude": -123.2715 }, { "latitude": 49.3783, "longitude": -123.2718 } ] }'

DELETE Request - Deleting all data in Global Path API

curl -X DELETE "http://localhost:3005/api/globalpath"

Command I ran to generate the path in the image above:

curl -X POST "http://localhost:3005/api/globalpath" \
     -H "Content-Type: application/json" \
     -d '[
       {
         "waypoints": [
           { "latitude": 49.37614179786771, "longitude": -123.27376619978901 },
           { "latitude": 49.37711663428484, "longitude": -123.27156381625609 },
           { "latitude": 49.378315644557176, "longitude": -123.27180418927239 },
           { "latitude": 49.381465588831524, "longitude": -123.27254420646906 },
           { "latitude": 49.3839035958063, "longitude": -123.2730793585836 },
           { "latitude": 49.38650818896502, "longitude": -123.27564156703514 },
           { "latitude": 49.38625857180026, "longitude": -123.28177300276381 },
           { "latitude": 49.382587584844835, "longitude": -123.29247537578034 },
           { "latitude": 49.37750287441669, "longitude": -123.29684958339224 },
           { "latitude": 49.37046373776872, "longitude": -123.3022011892728 },
           { "latitude": 49.362482757047864, "longitude": -123.30864508742094 },
           { "latitude": 49.35300923158242, "longitude": -123.31705995027019 },
           { "latitude": 49.34650411159584, "longitude": -123.3237483126415 },
           { "latitude": 49.34356040541922, "longitude": -123.34073692035749 },
           { "latitude": 49.342421649614984, "longitude": -123.34839354509414 },
           { "latitude": 49.34175775635472, "longitude": -123.35453636335373 }
         ]
       }
     ]'

@JordanChen123 JordanChen123 changed the title all post requests working, need to make changes to generic sensors th… Website POST request Handling Feb 3, 2025
@JordanChen123 JordanChen123 added the web Website team label Mar 15, 2025
@FireBoyAJ24 FireBoyAJ24 enabled auto-merge (squash) June 22, 2025 19:32
@JordanChen123 JordanChen123 self-assigned this Aug 20, 2025
@JordanChen123
Copy link
Contributor Author

JordanChen123 commented Aug 20, 2025

Will not continue with this MR, since there are security risks the way it is right now, and we don't need post request handling anymore (for now)

If we do end up needing post request handling in the future, will need to add to this MR:

  • Security Middleware
  • Update endpoints with security

@SPDonaghy SPDonaghy disabled auto-merge August 20, 2025 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web Website team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants