Project

apiif

0.0
No commit activity in last 3 years
No release in over 3 years
A gem that exposes an API based on folder structure
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.0
 Project Readme

API in folders

This is a gem that lets you whip up a quick "API" (not a real one, mind you; just some dummy endpoints, i.e., to build a prototype against) using folder structure.

How you use it

First set up a directory structure that maps to the API endpoints you want to have, with files named 'get.json', 'post.json', etc. for the HTTP methods you want to support. For example:

api/
  users/
    1/
      get.json
    get.json
  tasks/
    1/
      get.json
      put.json
    get.json
    post.json

In the example above, the following endpoints would be supported:

GET /users    # List users
GET /users/1  # Show user 1
GET /tasks    # List tasks
POST /tasks   # Create a task
GET /tasks/1  # Show task 1
PUT /tasks/1  # Update task 1

Once you've done that, navigate to the root of this directory tree you've just made and run:

apiif

Now, baby you've got a stew going.

Options

To see available command-line options (such as --port), run:

apiif --help