This is the backend for the University of Ilorin Faculty of Law Student Society (UILSS) website. It is written in Go and uses PostgreSQL as the database.
The following tools are required to set up this project:
- Go
- PostgreSQL
- sqlc
- Goose
- Make
Download and install Go from the official website.
Download and install PostgreSQL from the official website.
Install sqlc by running the following command:
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
Install Goose by running the following command:
go install github.com/pressly/goose/cmd/goose
Make is a build automation tool that can be installed from the package manager of your OS. For example,
on Ubuntu you can install it with:
sudo apt-get install make
on Windows you can install it with:
choco install make
- Clone the repository:
git clone https://github.com/musab-olurode/lis_backend.git
- Navigate to the project directory:
cd lis_backend
- Install the Go dependencies:
go mod tidy
- Environment variables:
- Create a
.env
file in the root directory of the project. - Copy the contents of
.env.example
into.env
. - Fill in the right values for the environment variables in
.env
(especially the database url and JWT secret).
- Run the migrations:
make migrate
To run the project, use the run
command:
make run
make tidy
: Cleans up the Go modules.make migrate
: Runs the database migrations.make migrate-down
: Rolls back the last database migration.make sqlc
: Generates Go code from SQL.