Use of this is for educational purposes only
URL to API is as listed below:
GET /- Server status checkGET /ip- Returns client's IP addressGET /date- Redirects to/api/dateGET /dev- Redirects to/api/dev
GET /api/date- Returns current dateGET /api/dev- Returns all employeesGET /api/dev/:id- Returns specific employee by IDPOST /api/addemployee- Add new employee (requiresfirst_nameandlast_namein body)
Send JSON with a non-empty message string (maximum 10,000 characters); userId and metadata are optional. Configure DATABASE_URL, or PGHOST, PGDATABASE, PGUSER, and PGPASSWORD. Locally, the backend reads backend/.env or backend/process.env; on hosts, set SECRETS_FILE or provide environment variables directly. The backend allows cross-origin requests from any site. Set TRUST_PROXY_HOPS to the number of trusted reverse proxies in production. Never commit populated secret files.
The QRAG artwork API is mounted at /api/artworks:
GET /api/artworks- List up to 200 artworks, newest first.GET /api/artworks?id=<id>orGET /api/artworks?barcode_id=<id>- Fetch an artwork by its barcode UUID or legacyqr_id. TheARTWORK:barcode prefix is optional. Returns404when no artwork matches.POST /api/artworks- Create an artwork usingmultipart/form-datafieldstitle(required),description(optional), andimage(required file). Returns201and the saved artwork.PUT /api/artworks?id=<id>- Update at least one oftitle,description, orimageusingmultipart/form-data. Requires thex-admin-tokenheader.
Artwork responses contain qr_id, barcode_id, title, description, artist, year, medium, image_url, image_public_id, accent, created_at, and updated_at. Titles are limited to 160 characters, descriptions to 5,000 characters, and images to 10 MB by default (JPEG, PNG, or WebP); MAX_UPLOAD_BYTES can change the upload limit. PostgreSQL is required. Image creation and replacement also require Cloudinary credentials via CLOUDINARY_URL or CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, and CLOUDINARY_API_SECRET; CLOUDINARY_FOLDER optionally selects the upload folder. Configure a random ADMIN_API_TOKEN of at least 32 bytes for update access. The database schema is initialized during backend startup and upgrades existing artwork tables without removing legacy IDs.
GET /api/grade-thresholds- Return saved grade thresholds and theirupdatedAttime.PUT /api/grade-thresholds- Save{ "grades": [...] }; requiresAuthorization: Bearer <ADMIN_API_KEY>.
The grade list must contain, in order, A+, A, A-, B+, B, C+, C, D, E, and G; mark thresholds must descend to 0, and points must be between 0 and 20. The server creates and seeds the grade_thresholds table during startup using the provisional values from backend/MyPNGCalculator/migrations/001_create_grade_thresholds.sql. Confirm official mark bands and points before operational use. The student calculator uses the stored points to calculate PNG as SUM(point × creditHours) / SUM(creditHours).
Set ADMIN_API_KEY for calculator updates. For QRAG updates, set a separate ADMIN_API_TOKEN (at least 32 bytes); do not expose either credential to browser code.
The integrated server exposes GET /health, which checks PostgreSQL connectivity. CORS allows requests from any browser origin. CORS is not authentication, so protect sensitive endpoints with their normal credentials.
GET /infositemrsm- Pull the saved settings JSON documentPOST /infositemrsm- Push a new settings JSON documentPUT /infositemrsm- Replace the saved settings JSON document
The json_documents table stores slides, announcements, and settings in separate PostgreSQL JSONB columns. It also retains the full request body in data so the existing API response format remains unchanged. On startup, existing documents are backfilled into the separate columns, and the infositemrsm document is initialized from settings/n.json when that file is present. If it is absent, the default is one blank slide (with template 1 and duration 5), empty announcements, and settings.slidingText set to an empty string. settings/m.json lists the available slide template IDs.
Example:
curl -X PUT http://gapim.onrender.com/infositemrsm \
-H "Content-Type: application/json" \
-d '{"slides":[{"title":"Welcome","message":"Hello","duration":5,"template":1}],"announcements":[],"settings":{"slidingText":"Welcome!"}}'
curl http://gapim.onrender.com/infositemrsmPOST returns 201 Created; PUT replaces the same document and returns 200 OK. Both methods accept a JSON request body, and GET returns the stored JSON directly. The existing database connection settings above are required.
POST /github/webhooks/- GitHub webhook handler for issues and ping events
Bugs? Any ideas for improvements? Feedback? Tell us on:
Credits:
- Ali Mozzabot I... Team Principal... Website Developer... Github
- Eiko... Right Hand Man(RHM)... Graphic Designer... Github
To do list:
- Security: resource