/shorter

Primary LanguageKotlin

Shorter

Written by kotlin, based on spark, mybatis

Given up, Just for fun

Run & Test

  1. Init DB src/storage/storage.sql

  2. Create conf/app.conf, example in conf/app.default.conf

  3. Run ./gradlew run

  4. Test ./gradlew test

API

Errors are in response's err json field

  1. [POST] /api/author

    • Body:

      {
          "name": "author"
      }
      
    • Response:

      {
          "data": "init_token"
      }
      

      Token is for publishing sheet. Once forgetting your token, you have to recreate author

  2. [POST] /api/sheet

    • Header:

      X-Token: your token

    • Body:

      {
          "type": "TEXT | LINK",
          "text": "required",
          "link": "required if type == LINK"
      }
      
    • Response:

      {
          "data": "next_token"
      }
      
  3. [GET] /api/sheet

    • Parameters:

      offset, count for pagination

    • Reposne:

      {
          data: [
              {
                  id: "1e7b03e5-9820-426f-ba52-65e925f5ad54",
                  author: "authorName",
                  type: "TEXT",
                  text: "sheetText",
                  link: "sheetLink"
              },
              {
                  id: "bd9e42ad-bafe-4cf5-9320-8088f7e87255",
                  author: "authorName",
                  type: "TEXT",
                  text: "sheetText",
                  link: "sheetLink"
              }
          ]
      }