Skip to content

avalchev94/to-do-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

ToDo App

Requirements

Install/Configure

After you have every of the above requirements:

  1. Download the project:
  go get -u github.com/avalchev94/to-do-api
  1. Update ./config/setup_env.sh enviroment variables.
  2. Open .bashrc*(on ubuntu ~/.bashrc)* and add the following code(replace GOPATH):
if [ -f ~/GOPATH/src/github.com/avalchev94/to-do-app/config/setup_env.sh ]; 
then
  . ~/GOPATH/src/github.com/avalchev94/to-do-app/config/setup_env.sh
fi
  1. Create the database and import the schema:
  dbcreate -U $PG_USER todo_app
  #go to to-do-app main directory
  psql -U $PG_USER todo_app < config/todoapp.sql
  1. Go to ./cmd/todo_app folder:
go build
./todo_app api

API Documentation

  • GET /login Returns the currently logged user:
    {"id": 1, "name":"avalchev", "email":"avl@bg.bg", "avatar":...}
  • POST /login Start new login session:
    {"name":"some_name", "password":"the_password"}
  • POST /user Register new user:
    {"name":"some_name", "password":"...", "email":"...", "avatar":"..."}
  • GET /user/:id Returns the specified user:
    {"id": 1, "name":"avalchev", "email":"avl@bg.bg", "avatar":...}
  • GET /user/:id/labels Returns the labels that the user created:
    [
      {"id":1,"user_id":1,"name":"Work","color":"123456"},
      {"id":2,"user_id":1,"name":"School","color":"ABCDEF"}
    ]
  • GET /user/:id/tasks Returns the tasks that the user created:
    [{"id":2,"user_id":1,"title":"sth","data":"I should..","labels":[{"id":1,"name":"Work","color":"123456"}],"labels_id":[1],"created":"2018-09..."}]
  • POST /label Create new label:
    {"name":"Work", "color":"000fff"}
  • GET /label/:id Get label with id:
    {"id":1,"user_id":1,"name":"Work","color":"123456"}
  • POST /task Create new task:
    {"title":"..", "data":"what u should do", "labels":[1, 5, 10]}
  • GET /task/:id Get task with id:
    {"id":2,"user_id":1,"title":"Finish..","data":"I should finish..","labels":[{"id":1,"name":"Work","color":"123456"}],"labels_id":[1],"created":"2018-09..."}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published