Skip to content

Simple API Server. My #001 Mini Project on learning Go.

Notifications You must be signed in to change notification settings

kokolingga/todolist-mysql-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TodoList API Server (Golang/MySQL)

My #001 Mini Project on learning Go.

Based on Mohamad Fadhil's blog post and medium

Prerequisites

  • Go
  • Docker

Setup

  • clone into your chosen folder (eq : ~/works/)

Setup and enter to MySQL bash

  • docker run -d -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=root mysql
  • docker exec -it mysql mysql -u root -p -e 'CREATE DATABASE todolist'
  • docker exec -it mysql bash
  • mysql -h localhost -u root -p

Run the Apps

  • $ go run todolist.go

Hit the endpoints

  • $ curl -i localhost:8000/healthz
  • $ curl -X POST -d "description=Cook for dinner" localhost:8000/todo
  • $ curl -X POST -d "completed=true" localhost:8000/todo/1
  • $ curl -X DELETE localhost:8000/todo/1
  • $ curl -i localhost:8000/todo-incomplete
  • $ curl -i localhost:8000/todo-completed

About

Simple API Server. My #001 Mini Project on learning Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages