Skip to content

Sample project written in golang for learning purposes. It's an API Rest using Gin gonic, GORM V2, Firebase authentication. Feel free to join us!

Notifications You must be signed in to change notification settings

Marian0/expenses-go-api

Repository files navigation

Expenses API

Project description

Expenses API for learning purposes written in golang using gorm v2, gin gonic, firebase auth and jwt.

Installation

  • clone this repo
  • copy environemnt variables cp .env.default .env
  • update env variables accordingly nano .env
  • Configure Firebase (see below)
  • run docker-compose up
  • run go run main.go

Firebase

  • Get the json file
  • Copy it to ./config/serviceAccountKey.json

How to create a new migration

  • Create a new file at database/migrations/YYYYMMDD000X_sample_summary_description.go
  • Note that the 4 ending chars represent an unique name and the description to understand what's the migration created for
  • Use the following template :

package migrations

import (
	"github.com/go-gormigrate/gormigrate/v2"
	"gorm.io/gorm"
)

var MYYYYMMDD000X = gormigrate.Migration{
	ID: "YYYYMMDD000X",
	Migrate: func(tx *gorm.DB) error {
    //add here schema changes
	},
	Rollback: func(tx *gorm.DB) error {
    //add here reverse schema changes
	},
}

  • Add this migragion object to the database/migrate.go array

About

Sample project written in golang for learning purposes. It's an API Rest using Gin gonic, GORM V2, Firebase authentication. Feel free to join us!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published