todo

Version, currently master branch1 version
  • master branchlatestJan 3, 2023

github.com/YotaroSeki/HTTPServer

HTTP server with amber

0 stars
0 dependents
License: UNLICENSED

Installation

# Add this to your shard.yml
dependencies:
  todo:
    github: YotaroSeki/HTTPServer
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.28.0
License
UNLICENSED
Author
YotaroSeki
Targets
  • todo from src/todo.cr
  • amber from lib/amber/src/amber/cli.cr

Dependencies

Runtime Dependencies

  • pg~> 0.16.1github: will/crystal-pg
  • amber0.28.0github: amberframework/amber
  • granite~> 0.15.0github: amberframework/granite
  • citrine-i18n0.3.2github: amberframework/citrine-i18n
  • quartz_mailer~> 0.5.1github: amberframework/quartz-mailer
  • jasper_helpers~> 0.2.1github: amberframework/jasper-helpers

Development Dependencies

  • garnet_spec~> 0.2.1github: amberframework/garnet-specdev

README

todo API server

set up

  1. Install Crystal lang
apt install crystal
  1. Install Amber framework
apt install amber
  1. Install postgresql
apt install postgres@11
  1. Edit config/environments/development.yml
database_url: postgres://#{YOUR_USER_NAME}:@localhost:5432/todo_development
  1. Create Table and migrate
amber db create migrate
  1. Run server
amber w

動作

  • 最初にlocalhost:3000にアクセスしてユーザー登録およびログインをする必要があります。
# イベント登録 API request
POST /api/v1/event
{"deadline": "2019-06-11T14:00:00+09:00", "title": "レポート提出", "memo": ""}

# イベント登録 API response
200 OK
{"status": "success", "message": "registered", "id": 1}

400 Bad Request
{"status": "failure", "message": "invalid date format"}
# イベント全取得 API request
GET /api/v1/event

# イベント全取得 API response
200 OK
{"events": [
    {"id": 1, "deadline": "2019-06-11T14:00:00+09:00", "title": "レポート提出", "memo": ""},
    ...
]}
# イベント1件取得 API request
GET /api/v1/event/${id}

# イベント1件取得 API response
200 OK
{"id": 1, "deadline": "2019-06-11T14:00:00+09:00", "title": "レポート提出", "memo": ""}

404 Not Found
# イベント1件削除 API request
DELETE /api/v1/event/${id}

# イベント1件取得 API response
204 OK

404 Not Found