GitXplorerGitXplorer
S

go-calorie-tracker

public
2 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
b6781b10aae0a9d23c964adbf04dbf478a187a04

Update Readme and Error handling

SSadeedpv committed a year ago
Unverified
42f3b694b986070a8873eefa8cb8e31ae4802b4b

Fix: Stop panic if failed to connect

SSadeedpv committed a year ago
Unverified
f140b0bc814a3b9d4aa128331c1e45f9f134ffe3

Update: Docker init-script

SSadeedpv committed a year ago
Unverified
b0fda33452e69a3afa5de51527fefe88b27af78e

Testing Docker

SSadeedpv committed a year ago
Unverified
1896791b3f5262cfa05ebefc1715d4863998002b

Set up Docker

SSadeedpv committed a year ago
Unverified
43f29439124b73aa76b28384e68c8cc76806c890

Fix load env

SSadeedpv committed a year ago

README

The README file for this repository.

Go Calorie Tracker

This is a simple Go application that allows users to track their daily calorie intake. The application uses a PostgreSQL database to store the data. The application is built using the Gin framework.

Prerequisites

  • PostgreSQL database
  • Go 1.21 or later
  • Docker

Installation

  1. Clone the repository
git clone https://github.com/Sadeedpv/go-calorie-tracker.git
  1. Install dependencies
go mod download
  1. Create a .env file and add your database credentials
DB_URL=postgres://user:password@localhost:5432/calorie_tracker
  1. Run the application
go run main.go

Usage

The application exposes the following endpoints:

  • /v1/calories: Get all calories
  • /v1/calories: Add a calorie
  • /v1/calories: Delete all calories
  • /v1/calories/:id: Get a calorie by ID
  • /v1/calories/:id: Update a calorie by ID
  • /v1/totalcalories: Get the total number of calories

Docker

You can also run the application using Docker.

  1. Build the image
docker build -t go-calorie-tracker .
  1. Run the container
docker run -p 8000:8000 go-calorie-tracker

Contributing

Contributions are welcome! Please open a pull request if you have any suggestions or improvements.