A RESTful HTTP API built with Go for managing a university appliance system. It provides user authentication, session management, and endpoints for handling student records.
- User Management: Create new users and manage authentication securely.
- Session Handling: Login and cookie-based session management using
gorilla/sessions. - Student Records: Create and link student profiles (First Name, Last Name, Middle Name, Birth Date, Achievements, Passport) to user accounts.
- RESTful Endpoints: Built using
gorilla/muxfor robust and scalable routing. - Database: PostgreSQL integration for persistent storage of users and student data.
- CORS Support: Configured to handle cross-origin resource sharing.
- Go 1.22.1 or higher
- PostgreSQL
The application uses a TOML configuration file located by default at configs/apiserver.toml. Ensure your database credentials and server settings are properly configured.
You can build the API server using the provided Makefile:
make buildThis will compile the binary in the cmd/apiserver directory. Run the server with:
./cmd/apiserver/apiserver --config-path configs/apiserver.tomlTo run the unit tests across the project:
make testPOST /users- Register a new userPOST /sessions- Login and create a new session
GET /private/whoami- Retrieve the currently authenticated user and their associated student profile.POST /private/students- Create a student profile and link it to the authenticated user.