This is the backend API for the CSMS (Campus Services Management System) project. It provides endpoints for managing vending machine orders and monitoring system data.
-
Clone the repository
git clone https://github.com/yourusername/csms-backend.git cd csms-backend
-
Install dependencies
- Install Deno
- Configure environment variables
Create a
.env
file with:MONGO_URL=your_mongodb_connection_string
- Run the server
deno run --allow-net --allow-env index.ts
GET /order?email={email}&hash={hash}
Returns order details for the given email and hash combination.
Parameters:
email
: User's email addresshash
: Order hash
Response:
{
"hash": "string",
"items": {
"itemId": "quantity"
},
"timestamp": "string",
"status": "Placed|Done",
"totalCost": number
}
GET /order/complete?email={email}&hash={hash}
Marks an order as completed.
Parameters:
email
: User's email addresshash
: Order hash
Response:
{
"status": "success"
}
The API returns appropriate HTTP status codes:
- 200: Success
- 400: Bad Request (missing parameters)
- 404: Not Found (order doesn't exist)
- 500: Internal Server Error
- Deno
- Oak (web framework)
- MongoDB
- TypeScript