erestourant

module
v0.0.0-...-c4c153e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: MIT

README ΒΆ

πŸ₯˜ eRestourant

A simple restaurant backend service built with Go and the Gin web framework. It supports environment-based configuration and PostgreSQL integration.


πŸ“ Project Structure

.
β”œβ”€β”€ build/              # Compiled binary output
β”œβ”€β”€ cmd/
β”‚   └── api/            # Main application entry point
β”‚       └── main.go
β”œβ”€β”€ config/             # Configuration-related code
β”œβ”€β”€ internal/           # Application logic (handlers, services, etc.)
β”œβ”€β”€ sqlc.yaml           # SQLC config for database interaction
β”œβ”€β”€ go.mod / go.sum     # Go module definitions
β”œβ”€β”€ .env                # Environment variables
β”œβ”€β”€ makefile            # Build/run automation
└── README.md           # Project documentation

πŸš€ Getting Started

Prerequisites

βš™οΈ Configuration

Create a .env file in the root directory:

PORT=5000
ENV="DEVELOPMENT"
DB_CONN_URI="postgres://postgres:postgres@localhost:5432/erestourant"

πŸ› οΈ Build & Run

You can build and run the project using the makefile:

Build
make build
Run
make run

This will compile the code and run the server at:

http://localhost:5000

🧹 Clean Build Artifacts

make clear

πŸ—ƒοΈ Database

The project expects a PostgreSQL database running with the following default config (can be changed in .env):

  • User: postgres
  • Password: postgres
  • Database: erestourant
  • Host: localhost
  • Port: 5432

πŸ“¦ Dependencies

Install dependencies via:

go mod tidy

πŸ“Œ Routes Overview

The API is organized into modular route groups:

πŸ” Auth Routes

Handles user authentication

Method Endpoint Description
POST /auth/login Log in a user
POST /auth/register Register a new user

πŸ“‹ Menu Routes

Manages menu items in the restaurant

Method Endpoint Description
GET /menu/ Get all menu items
GET /menu/:id Get details of a menu item by ID
POST /menu/ Create a new menu item
PUT /menu/:id Update a menu item by ID
DELETE /menu/:id Delete a menu item by ID

πŸ›’ Order Routes

Manages customer orders

Method Endpoint Description
GET /order/ Get all orders
GET /order/:id Get order details by ID
GET /checkout/order/:id Marks an order a complete
POST /order/ Create a new order
PUT /order/:id Update an existing order
DELETE /order/:id Delete an order by ID

πŸ‘€ User Routes

Handles user management

Method Endpoint Description
GET /user/ Get all users
GET /user/:id Get user details by ID
DELETE /user/:id Delete a user by ID

πŸ“Œ TODO

  • Implement authentication middeware
  • Implement some admin features

Directories ΒΆ

Path Synopsis
cmd
api command
internal
db
dto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL