Giter Site home page Giter Site logo

mockacino's Introduction

Mockacino

A very simple and easy to use MOCK API server that serves static JSON written in ruby/sinatra.


NOTE: This is a super simple, super fragile MOCKING SERVER Intended so you can test routes and mock an API with static jso whilst you're still building the real production API. DO NOT EVER use this in production... Seriously. It breaks a lot and will if you try... DONT. Absolutely 0 effort went into it, therefor 0 Warranty. Use if you dare.

DOCS:

Folder structure defines API calls.... return.json is what gets served.

site_root ->
    [ http method ] -> [ api call route ] -> [ json response contents of call return.json ] 

e.g.

site_root ->
    GET -> users -> return.json
    POST -> users -> create -> return.json

If you have static assets you wanna reference in the json, plonk them in the ASSETS folder

e.g.

site_root -> file.jpg

You can call http://yourhost:port/ASSETS/file.jpg

Here's the directory structure of the sample project included here

mockacino.rb  
./site_root/ASSETS
./site_root/GET
./site_root/POST
./site_root/GET/sheep
./site_root/GET/sheep/create
./site_root/GET/sheep/return.json
./site_root/GET/sheep/create/return.json

Which supports calls like...

http://localhost:4567/sheep
http://localhost:4567/sheep/create

And gives responses from the static result.json file like...

{
    "sheep": [
        {
            "id": "1234",
            "name": "Dolly Two",
            "url": "http://mike.kz/sheep1234",
            "assets": {
                "small_image": "http://cloned.sheep.com/ASSETS/small.jpg",
                "large_image": "http://cloned.sheep.com/ASSETS/large.jpg"
            }
        }
    ]
}

Usage:

gem install sinatra
ruby mockacino.rb

=) I'm @ArmstrongAtWork on Twitter if you wanna moan.

mockacino's People

Contributors

michaelarmstrong avatar

Stargazers

greg avatar William Mathewson avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.