Categorygithub.com/JuanCampbsi/api_go_rest
repositorypackage
0.0.0-20230530124302-e69d0c4c7acd
Repository: https://github.com/juancampbsi/api_go_rest.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Go Reference

Api Go REST

🛠 Description


This project aims to create a simple REST API using the Go programming language (Golang). It leverages various Go libraries to handle routing (Gorilla Mux), logging (httpsnoop), CORS middleware (Gorilla handlers), and database interactions (pgx, gorm). The API connects to a PostgreSQL database and uses GORM (Go Object-Relational Mapper) for database operations..

Preview


Intro


⌨ Database configuration

Create an .env file in the root of the project and define your database user and password in it and place the file in docker-compose.yml For example:

# .env
 DATABASE_USER=use
 DATABASE_PASSWORD=password

# use in docker-compose.yml 
 PGADMIN_DEFAULT_EMAIL: ${DATABASE_USER}
 PGADMIN_DEFAULT_PASSWORD: ${DATABASE_PASSWORD}   

⌨ Installation

To use it, you need to clone the repository, install the dependencies and run the project.

# Open terminal/cmd and then Clone this repository
$ git clone https://github.com/JuanCampbsi/api_go_rest.git

# Access project folder in terminal/cmd
$ cd api_go_rest

# Install the dependencies
$ go mod tidy

# Run the application in development mode
$ go run main.go

# In order to create a container for this application, you'll need to run Docker command. 
#Please ensure that Docker is already installed on your machine before proceeding. 
#If you don't have Docker installed, you can download it from the 
#[official website](https://www.docker.com/products/docker-desktop).

$ docker compose up                                 


⌨ Stack of technologies and libraries


👨‍💻 Author 💻

Developed by Juan Campos