Implementing a restful-api with Golang.

Go-REST

Create a restful api with Golang.
The main idea behind this project was to gain some knowledge about implementing a rest-api in Golang.

Setup

Clone the project and use the following command to set up the server:

go run cmd/main.go

Result should be something like this:

2021/12/18 11:09:19 Server started ...

Endpoints

  • /api/books

    • returns the list of the books
    • method = GET
  • /api/books/{id}

    • returns information of a single book
    • method = GET
  • /api/books

    • creates a new book and returns the created book
    • method = POST
  • /api/books/{id}

    • updates a book by its id
    • method = PUT
  • /api/books/{id}

    • deletes a book
    • method = DELETE

Features

  • use mux package to create routes
  • rest-api implementation
  • mysql database
  • golang orm

Tools

  • go (version 1.17)
  • mux (version 8)
  • gorm (version 22)
  • mysql (2)
Owner
AmirH.Najafizadeh
Amirhossein Najafizadeh , 20 years old computer engineer.
AmirH.Najafizadeh
Similar Resources

⚓️ Golang RESTful APIs

Golang RESTful Golang RESTful API started on January 23rd, 2022. 环境配置相关解决办法

Jan 23, 2022

A lightweight RESTful web framework for Go

A lightweight RESTful web framework for Go

Goweb A lightweight RESTful web framework for Go. For examples and usage, please read the Goweb API Documentation Read our Articles Who uses Goweb? "U

Jan 5, 2023

Project template for creating an RESTful webservice in Go, with relational database backend & example content.

gofound-restful Project template for creating an RESTfull webservice in Go, with relational database backend and example content. Used packages github

Dec 15, 2022

弹弹play 资源搜索节点 API 实现,基于 Cloudflare Workers 或 Golang 的两种实现。 || API implementations for "dandanplay" resource search service.

dandanplay-resource-service API implementations for "dandanplay" resource search service. 弹弹play 资源搜索节点的 API 实现。 提供基于 Cloudflare Workers 和 Golang 的两种实

Dec 5, 2022

REST API made using native Golang libraries. This API resembles the basic working of Instagram.

REST API made using native Golang libraries. This API resembles the basic working of Instagram.

Golang RESTful API for Instagram A Go based REST API built using native libraries. The API has been thoroughly worked through with Postman. Routes inc

Mar 16, 2022

Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects

Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects

Couper Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects. Getting started The quick

Nov 18, 2022

Boilerplate API template includes all the common packages and setup used for API development in this Company

Boilerplate API Boilerplate API template includes all the common packages and setup used for API development in this Company. Development Copy .env.ex

Feb 19, 2022

Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance. Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。

Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance.  Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。

Tigo(For English Documentation Click Here) 一个使用Go语言开发的web框架。 相关工具及插件 tiger tiger是一个专门为Tigo框架量身定做的脚手架工具,可以使用tiger新建Tigo项目或者执行其他操作。

Jan 5, 2023
A Golang restful API boilerplate based on Echo framework v4

A Golang restful API boilerplate based on Echo framework v4. Includes tools for module generation, db migration, authorization, authentication and more.

Nov 15, 2022
A quick and easy way to setup a RESTful JSON API

Go-Json-Rest A quick and easy way to setup a RESTful JSON API Go-Json-Rest is a thin layer on top of net/http that helps building RESTful JSON APIs ea

Jan 3, 2023
TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON.

Dec 10, 2022
This project demonstrates a simple RESTful API built with Go and Chi.
This project demonstrates a simple RESTful API built with Go and Chi.

Go and chi RESTful API This project demonstrates a simple RESTful API built with Go and chi. This API provides the following endpoints: GET / - Verify

Dec 14, 2022
An example repo for RESTful API with swagger docs & unit testing

go REST API An example repo for RESTful API with swagger docs & unit testing Starting development server Copy .env.example to .env in the same directo

Nov 5, 2021
An restful api that uses CRUDL to support user endpoints. Stores the users in mysqlite. Creates 10 users when the program starts.

UserAPI An restful api that uses CRUDL to support user endpoints. Stores the users in mysqlite. Creates 10 users when the program starts. How to start

Nov 26, 2021
GateCracker-REST - A RESTful API example for simple lock model information application with Go
GateCracker-REST - A RESTful API example for simple lock model information application with Go

Go Lock Models REST API Example A RESTful API example for simple lock model info

Jun 11, 2022
Go-userapi-rest - Build a RESTful API that can get/create/update/delete user data from a persistence database

GO ASSIGNMENT Overview of the Task Context Build a RESTful API that can get/crea

Sep 6, 2022
Implementing back-end services for blog application

Go Blog API Real-world examples implementing back-end services for blog application using Go programming language to build RESTful API, all routes and

Jan 5, 2023
Fastrest - fast restful framework for golang.

fastrest fast restful framework for golang. Create your app directory, like mkdir myapp; cd myapp; go mod init myapp; Create initial config.toml in a

Nov 8, 2022