Skip to content

sigit-prayoga/go-todo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-todo

Simple Todo list backend with Go

Install all dependencies

$ go get

Compile and run

$ go run main.go

Install postgres

$ sudo apt-get install postgres

# Switch to 'postgres'
$ sudo su - postgres

# Start to work with psql
$ psql

Create Todos table

Type this CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; to work with UUID. And then, use create table todos(todo text, done boolean default false, id uuid not null default uuid_generate_v4()); to create a todos table. To verify table, use \d+ todos.

Test your application

# Get all todo
$ curl http://localhost:8383/todos

# Add new todo
$ curl -X POST -d '{"todo":"Learn more about Go"}' http://localhost:8383/todos

# Update todo
$ curl -X UPDATE -d '{"todo":"Learn more about Go", "id":"<some_id>", "done":true}' http://localhost:8383/todos

# Delete todo
$ curl -X DELETE -d '{"id":"<some_id>"}' http://localhost:8383/todos

About

Simple Todo list backend with Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages