Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

University Appliance REST API

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.

Features

  • 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/mux for robust and scalable routing.
  • Database: PostgreSQL integration for persistent storage of users and student data.
  • CORS Support: Configured to handle cross-origin resource sharing.

Prerequisites

  • Go 1.22.1 or higher
  • PostgreSQL

Getting Started

Configuration

The application uses a TOML configuration file located by default at configs/apiserver.toml. Ensure your database credentials and server settings are properly configured.

Build and Run

You can build the API server using the provided Makefile:

make build

This will compile the binary in the cmd/apiserver directory. Run the server with:

./cmd/apiserver/apiserver --config-path configs/apiserver.toml

Testing

To run the unit tests across the project:

make test

API Endpoints

Public Endpoints

  • POST /users - Register a new user
  • POST /sessions - Login and create a new session

Private Endpoints (Requires Authentication)

  • 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages