Coder Social home page Coder Social logo

api_go_rest's Introduction

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

api_go_rest's People

Stargazers

 avatar

Watchers

 avatar

Forkers

caetanomarcus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.