Api-go-template - A simple Go API template that uses a controller-service based model to build its routes

api-go-template

This is a simple Go API template that uses a controller-service based model to build its routes.

Directory tree

├── output/
│   ├── text_file_1.txt
│   ├── text_file_2.txt
├── routes/
│   ├── end/
│   │   ├── controller.go
│   │   ├── route.go
│   │   └── service.go
│   └── root/
│       ├── controller.go
│       ├── route.go
│       └── service.go
├── go.mod
├── go.sum
├── main.go
├── README.md
├── routes.go

Output

The output directory stores all files that are created when you sent a request.

Routes/

The routes directory stores all routes definitions and its components.

Controller.go

This file defines the HTTP interaction for the route. It translates and treats the Fiber context to useful information for the service. That means it provides the HTTP interface for the service.

Route.go

This file defines the Method, the path for the route and the Handler creation function. It exports everything needed to the main.go file to recognize this route.

Service.go

The guts and the raw functions that execute the operations needed for the system to work.

⚠️ Should not have any coupling to HTTP. These functions should only have the strict necessary to work.

main.go

API initialization and API execution.

routes.go

API route definition throughout the imports of the handlers created on the routes/ directory.

Owner
Pedro Espíndula
Site Reliability Engineer @ pagar.me
Pedro Espíndula
Similar Resources

Golang Service Template

Golang Service Template Golang back-end service template. Using this template, you can get started with back-end projects quickly. Web Framework ORM D

Jun 8, 2022

A sane and simple Go REST API template.

Gosane 🧘‍♀️ A sane and simple Go REST API template. Clone me and edit me to fit your usecase. What is Gosane? Gosane is a cloneable API template to g

Dec 7, 2022

A simple template using Fiber for me to bootstrap API services quickly.

Fiber Template A simple template using Fiber for me to bootstrap API services quickly. Features Fiber GORM air for hot reloading ... and possibly more

Dec 16, 2021

Paste basic or template-based keys and passwords

pasteword Paste basic or template-based keys and passwords. Retrieve passwords and temporarily put them into the clipboard for easy copy-pasting. On m

Dec 11, 2021

Simple and fast template engine for Go

fasttemplate Simple and fast template engine for Go. Fasttemplate performs only a single task - it substitutes template placeholders with user-defined

Dec 30, 2022

Simple template suitable for building a webapp backend MVP written in go

A Simple Go Project Template - Suited for Webapp MVPs A simple go project structure setup with all dependencies you need to get your MVP off the groun

Oct 23, 2022

This is a simple GoLang script template.

This is a simple GoLang script template.

Oct 25, 2022

Template for Golang rest API using Fiber

Rest API Setup DB sudo -S docker-compose -f db.yml up -d Build container sudo -S docker build -t rest-api-image . Run container from image sudo -S doc

Dec 5, 2021

HTML template engine for Go

Ace - HTML template engine for Go Overview Ace is an HTML template engine for Go. This is inspired by Slim and Jade. This is a refinement of Gold. Exa

Jan 4, 2023
A shot API template following MVC model

Go API template This project is mainly personnal, to have a quick ready-to-go API template in go using gin gonic How does it works ? Main call interna

Nov 23, 2021
A template to build dynamic web apps quickly using Go, html/template and javascript
A template to build dynamic web apps quickly using Go, html/template and javascript

gomodest-template A modest template to build dynamic web apps in Go, HTML and sprinkles and spots of javascript. Why ? Build dynamic websites using th

Dec 29, 2022
Wrapper package for Go's template/html to allow for easy file-based template inheritance.

Extemplate Extemplate is a small wrapper package around html/template to allow for easy file-based template inheritance. File: templates/parent.tmpl <

Dec 6, 2022
Goview is a lightweight, minimalist and idiomatic template library based on golang html/template for building Go web application.

goview Goview is a lightweight, minimalist and idiomatic template library based on golang html/template for building Go web application. Contents Inst

Dec 25, 2022
Go-api-template - A rough template to give you a starting point for your API

Golang API Template This is only a rough template to give you a starting point f

Jan 14, 2022
Simple system for writing HTML/XML as Go code. Better-performing replacement for html/template and text/template

Simple system for writing HTML as Go code. Use normal Go conditionals, loops and functions. Benefit from typing and code analysis. Better performance than templating. Tiny and dependency-free.

Dec 5, 2022
A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.
A maroto way to create PDFs. Maroto is inspired in Bootstrap and uses gofpdf. Fast and simple.

Maroto A Maroto way to create PDFs. Maroto is inspired in Bootstrap and uses Gofpdf. Fast and simple. Maroto definition: Brazilian expression, means a

Jan 7, 2023
Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template

quicktemplate A fast, powerful, yet easy to use template engine for Go. Inspired by the Mako templates philosophy. Features Extremely fast. Templates

Dec 26, 2022
Made from template temporalio/money-transfer-project-template-go
Made from template temporalio/money-transfer-project-template-go

Temporal Go Project Template This is a simple project for demonstrating Temporal with the Go SDK. The full 20 minute guide is here: https://docs.tempo

Jan 6, 2022
Go-project-template - Template for a golang project

This is a template repository for golang project Usage Go to github: https://git

Oct 25, 2022