Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
150 lines (115 sloc) 2.08 KB

mazimd-api

The api server for mazimd

http://api.mazimd.com

Getting Started

  1. Install Node.js
  2. Install and run MongoDB
  3. npm install
  4. npm start
  5. Visit http://localhost:8110

API

Get a page

GET /pages/:id

Response

Status: 200 OK
{
  "url": "http://api.mazimd.com/pages/1gyf5gloc",
  "html_url": "http://mazimd.com/pages/1gyf5gloc",
  "id": "1gyf5gloc",
  "content": "# Hello World",
  "created_at": "2017-06-28T06:56:17.244Z"
}

Create a page

POST /pages

Input

{
  "content": "# Hello World",
  "expire_in": "1h"
}

Response

Status: 201 Created
{
  "url": "http://api.mazimd.com/pages/1gyf5gloc",
  "html_url": "http://mazimd.com/pages/1gyf5gloc",
  "id": "1gyf5gloc",
  "content": "# Hello World",
  "created_at": "2017-06-28T06:56:17.244Z"
}

Get a theme

GET /themes/:id

Response

Status: 200 OK
{
  "url": "http://api.mazimd.com/themes/y7v359y4",
  "html_url": "http://mazimd.com/themes/y7v359y4",
  "id": "y7v359y4",
  "name": "Test theme",
  "css": "h1 { background: red; }",
  "created_at": "2017-06-30T03:08:12.688Z"
}

Create a theme

POST /themes

Input

{
  "name": "Base theme",
  "css": "# Hello World"
}

Response

Status: 201 Created
{
  "url": "http://api.mazimd.com/themes/y7v359y4",
  "html_url": "http://mazimd.com/themes/y7v359y4",
  "id": "y7v359y4",
  "name": "Test theme",
  "css": "h1 { background: red; }",
  "created_at": "2017-06-30T03:08:12.688Z"
}

List all themes

GET /themes

Response

[
  {
    "url": "http://api.mazimd.com/themes/y7v359y4",
    "html_url": "http://mazimd.com/themes/y7v359y4",
    "id": "y7v359y4",
    "name": "Test theme",
    "created_at": "2017-06-30T03:08:12.688Z"
  }
]