From 0e52a5e93680a87add4da7ab5ddf5555b2004fc4 Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Tue, 24 Apr 2018 20:55:12 -0700 Subject: [PATCH] beginning work on docs --- app.moon | 1 + applications/api.moon | 10 ---------- applications/docs.moon | 26 ++++++++++++++++++++++++++ layouts/main.moon | 2 +- 4 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 applications/docs.moon diff --git a/app.moon b/app.moon index 0477370..78bc737 100644 --- a/app.moon +++ b/app.moon @@ -14,6 +14,7 @@ class Simplex extends Application @include locate "users" @include locate "api" + @include locate "docs" -- TODO intentionally cause an error to see if this is working as intended handle_error: (err, trace) => diff --git a/applications/api.moon b/applications/api.moon index 27dd3ec..f02160a 100644 --- a/applications/api.moon +++ b/applications/api.moon @@ -157,13 +157,3 @@ class API extends Application return json: { success: true } else abort 500, "Error deleting api_key." - - -- /new { content: "string" } - -- /do { id: # } or content - -- /undo { id: # } or content - -- /get { id: # } or content - -- /random { count: #, done: bool } (both args optional, defaults count 1, done false) - -- /list { count: #, done: bool, page: #, order: asc/desc } (if done not specified, returns all, - -- default count is 50, default page is 1, default order is latest first - -- /key/new - -- /key/delete { id: #, key: "str" } diff --git a/applications/docs.moon b/applications/docs.moon new file mode 100644 index 0000000..3640993 --- /dev/null +++ b/applications/docs.moon @@ -0,0 +1,26 @@ +import Application from require "lapis" + +class Docs extends Application + @path: "/docs" + @name: "docs_" + + [index: ""]: => + @html -> + h3 "Hi there." + a href: @url_for("docs_v1"), "click here" + + [v1: "/v1"]: => + @html -> + p "ToDo. Write this." + + -- /new { content: "string" } + -- /get { id: # } or content + -- /do { id: # } or content + -- /undo { id: # } or content + -- /delete { id: # } or content + -- /random { count: #, done: bool } (both args optional, defaults count 1, done false) + -- /list { count: #, done: bool, page: #, order: asc/desc } (if done not specified, returns all, + -- default count is 50, default page is 1, default order is latest first + + -- /key/new + -- /key/delete { id: #, key: "str" } diff --git a/layouts/main.moon b/layouts/main.moon index d0106bc..eba6d3c 100644 --- a/layouts/main.moon +++ b/layouts/main.moon @@ -23,7 +23,7 @@ class extends Widget div class: "container", -> div class: "row", -> div class: "column column-25 btns", -> - a class: "button", href: "#", "API Docs" + a class: "button", href: @url_for("docs_v1"), "API Docs" div class: "column column-100", -> h1(@title or "Simplex") div class: "column column-25 btns", ->