Skip to content

Real-Dev-Squad/reciprocal-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reciprocal Backend

This is the backend for the Reciprocal project. It is a Go application built using the Standard Library.

Setup local development environment

  1. Install Go 1.23.1
  • if you have a different version of Go installed, visit the Managing Go installations page to learn how to manage multiple versions of Go on your machine.
  1. Install Docker desktop, make sure you have compose V2.*, available when you install Docker Desktop.

  2. Install air to enable hot reloading of the application.

  3. Install Packages

go mod download
  1. Run the setup script to create .env file and setup database, make sure you have docker running and make installed.
make setup
  1. Create the tables used to keep track of migrations
make migration-init
  • if you do not have make installed, you can run the following command:
go run cmd/bun/main.go db init
  1. Run the application
make watch
  1. You can now access the application at http://localhost:4000

Migrations

Create the tables used to keep track of migrations

  1. To create the tables used to keep track of migrations, run the following command:
make migration-init

If you do not have make installed, you can run the following command:

go run cmd/bun/main.go db init

Create a new migration

  1. To create a new migration, run the following command:
make create-migration
  1. You will be prompted to enter the name of the migration.
Enter migration name: <migration_name>

If you do not have make installed, you can run the following command:

go run cmd/bun/main.go db create_sql <migration_name>

Run migrations

  1. To run migrations, run the following command:
make migrate

If you do not have make installed, you can run the following command:

go run cmd/bun/main.go db migrate

Rollback the last migration

  1. To rollback migrations, run the following command:
make rollback

If you do not have make installed, you can run the following command:

go run cmd/bun/main.go db rollback

Check migration status

  1. To check the status of migrations, run the following command:
make status

If you do not have make installed, you can run the following command:

go run cmd/bun/main.go db status

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published