Skip to content

0bvim/go_rest_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful API Project

This readme is just a snippet that I've created and I will finish it latter.

This project implements a RESTful API using Go (Golang) as the backend language, PostgreSQL as the database, and Docker for containerization.

Table of Contents

  1. Project Overview
  2. Technology Stack
  3. Getting Started
  4. API Endpoints
  5. Database Schema
  6. Docker Configuration
  7. Code Structure
  8. Testing
  9. Deployment
  10. Contributing
  11. License

Project Overview

This RESTful API project provides a scalable and maintainable backend service. It uses Go for its performance and concurrency capabilities, PostgreSQL for robust database operations, and Docker for easy deployment and containerization.

Technology Stack

  • Backend Language: Golang
  • Database: PostgreSQL
  • Containerization: Docker

Getting Started

To run the project locally:

  1. Clone the repository:

  2. Build the Docker image:

  3. Run the Docker container:

Your API should now be accessible at http://localhost:8080.

API Endpoints

The API currently supports the following endpoints:

  • GET /users: Retrieve all users
  • POST /users: Create a new user
  • GET /users/{id}: Get a specific user by ID
  • PUT /users/{id}: Update a user
  • DELETE /users/{id}: Delete a user

Detailed documentation for each endpoint can be found in the api package.

Database Schema

The database schema is defined in the migrations folder. It includes tables for users and potentially other entities as the project grows.

Docker Configuration

Docker configuration files are located in the docker folder. They define the environment for both development and production setups.

Code Structure

The project follows a clean architecture pattern:

  • cmd: Contains the main application entry point
  • internal: Houses internal packages and logic
    • app: Application-specific business logic
    • domain: Domain models and interfaces
    • infrastructure: External dependencies (database, etc.)
    • interfaces: API handlers and middleware
  • pkg: Reusable packages across multiple projects
  • tests: Unit tests and integration tests

Testing

Unit tests are implemented using Go's built-in testing package. Integration tests are also included to verify the functionality of the API endpoints.

Run tests with:

Deployment

The project is designed to be easily deployable using Docker. For production deployment, consider using orchestration tools like Kubernetes.

Contributing

Contributions are welcome! Please submit pull requests with clear explanations of changes made.

License

This project is licensed under the MIT License. See LICENSE.md for details.

About

Golang restAPI using docker and postgres

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published