• Stars
    star
    523
  • Rank 81,416 (Top 2 %)
  • Language
    Go
  • Created about 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📚 A RESTful API example for simple todo application with Go

Go Todo REST API Example

A RESTful API example for simple todo application with Go

It is a just simple tutorial or example for making simple RESTful API with Go using gorilla/mux (A nice mux library) and gorm (An ORM for Go)

Installation & Run

# Download this project
go get github.com/mingrammer/go-todo-rest-api-example

Before running API server, you should set the database config with yours or set the your database config with my values on config.go

func GetConfig() *Config {
	return &Config{
		DB: &DBConfig{
			Dialect:  "mysql",
			Username: "guest",
			Password: "Guest0000!",
			Name:     "todoapp",
			Charset:  "utf8",
		},
	}
}
# Build and Run
cd go-todo-rest-api-example
go build
./go-todo-rest-api-example

# API Endpoint : http://127.0.0.1:3000

Structure

├── app
│   ├── app.go
│   ├── handler          // Our API core handlers
│   │   ├── common.go    // Common response functions
│   │   ├── projects.go  // APIs for Project model
│   │   └── tasks.go     // APIs for Task model
│   └── model
│       └── model.go     // Models for our application
├── config
│   └── config.go        // Configuration
└── main.go

API

/projects

  • GET : Get all projects
  • POST : Create a new project

/projects/:title

  • GET : Get a project
  • PUT : Update a project
  • DELETE : Delete a project

/projects/:title/archive

  • PUT : Archive a project
  • DELETE : Restore a project

/projects/:title/tasks

  • GET : Get all tasks of a project
  • POST : Create a new task in a project

/projects/:title/tasks/:id

  • GET : Get a task of a project
  • PUT : Update a task of a project
  • DELETE : Delete a task of a project

/projects/:title/tasks/:id/complete

  • PUT : Complete a task of a project
  • DELETE : Undo a task of a project

Todo

  • Support basic REST APIs.
  • Support Authentication with user for securing the APIs.
  • Make convenient wrappers for creating API handlers.
  • Write the tests for all APIs.
  • Organize the code with packages
  • Make docs with GoDoc
  • Building a deployment process

More Repositories

1

diagrams

ðŸŽĻ Diagram as Code for prototyping cloud system architectures
Python
33,942
star
2

go-web-framework-stars

⭐ Web frameworks for Go, most starred on GitHub
Go
3,308
star
3

git-tips

📚 Git 팁 ëŠĻėŒė§‘ (https://github.com/git-tips/tips 한ęĩ­ė–ī ëē„ė „)
1,016
star
4

flog

ðŸŽĐ A fake log generator for common log formats
Go
997
star
5

commonregex

ðŸŦ A collection of common regular expressions for Go
Go
861
star
6

awesome-finder

😎 Search the awesome curated list without browser
Python
269
star
7

pyreportcard

ðŸšĨ A report card for Python application
Python
100
star
8

cfmt

ðŸŽĻ Contextual fmt inspired by bootstrap color classes
Go
100
star
9

funmath

☔ Implementations of mathematical functions, formulas and concepts
Python
91
star
10

blockchain-tutorial

ëļ”록ėēīėļ 튜토ëĶŽė–ž (Building Blockchain in Go 한ęĩ­ė–ī ëē„ė „)
90
star
11

python-web-framework-stars

⭐ïļ Web frameworks for Python, most starred on Github
Python
68
star
12

round

🌀 A command-line for rounding the images
Go
57
star
13

gobyexample

🎁 Go By Example 한ęĩ­ė–ī ëē„ė „
HTML
57
star
14

gosearch

🔍 Search the Go packages via command-line
Go
53
star
15

python-curses-scroll-example

📚 How to implement the scroll and paging in Python curses
Python
46
star
16

gomo

🍔 Terminal based memo application written in Go
Go
40
star
17

redis-migrate

ðŸ“Ū Simple command line tool for redis data migration (minimal functionality)
Python
38
star
18

sorting

ðŸĄ Visualize the process of sorting algorithms simply
Python
25
star
19

go-codelab

🍰 Simple codelab for learning Go language (simple and tiny IoT service)
Go
20
star
20

sheet2db

A tiny python library for syncing data from google spreadsheet to database
Python
18
star
21

mingrammer

mingrammer
15
star
22

casec

🌈 A text case converter
Go
14
star
23

clip

📎 A simple key-value store for clipboard
Go
11
star
24

architecture-by-me

A collection of architectures made by myself
10
star
25

fitter

🍭 An on-demand image server for generating dynamic images
Python
10
star
26

cs231n-numpy-tutorial

IPython notebook for cs231n python numpy tutorial
Jupyter Notebook
7
star
27

tyfy

Truthy and falsy text validators
Go
6
star
28

os-assign

OS programming assignment
C
5
star
29

homebrew-flog

Homebrew tap repository for github.com/mingrammer/flog
Ruby
4
star
30

docker-complex-app

Example repository for testing the CI/CD flow with multi-docker
JavaScript
4
star
31

dynamodb-toolkit

A command line toolkit for aws dynamodb
Go
4
star
32

dotfiles

mingrammer's dotfiles
Vim Script
3
star
33

mingrammer.github.io

ðŸģ mingrammer's note
CSS
3
star
34

python-practices

🐍 A cureated collection of python practices for various topics
Python
3
star
35

go-mod-onbuild

ðŸģ Go + module onbuild image
Dockerfile
3
star
36

problem-solving

A collection of problem solving solutions
Python
2
star
37

bit-counter

ðŸ’Ą A simple bit counter
Python
2
star
38

go-simple-crawler-practice

Simple crawler for learning go
Go
2
star
39

meetup-api

API & Slack bot RTM server for 9XD meetup service
Go
2
star
40

deep-learning-from-scratch

Jupyter notebooks for "deep learning from scratch" book
Jupyter Notebook
1
star
41

atom-settings

my settings for atom editor
CoffeeScript
1
star
42

wiki

My personal wiki
1
star
43

project-euler

A collection of project euler solutions
Python
1
star
44

go-simple-chat-practice

Simple chat server for learning go
Go
1
star
45

coursera-machine-learning

Exercises for coursera machine learning course
MATLAB
1
star
46

docker-react

Example repository for testing the CI/CD flow with docker
JavaScript
1
star