Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
/ mockapi Public archive

A quick and dirty api framework in node. Great for quickly mocking out or prototyping an api.

Notifications You must be signed in to change notification settings

epixa/mockapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mockapi - Bootstrap your api

A quick and dirty API framework, mockapi is best suited for rapidly building API prototypes or mock APIs. It's built on express, but its specifically tailored for building REST APIs that return JSON.

Installation

$ npm install -g mockapi

Usage / Getting Started

Simply run mockapi from within a working directory, run npm install, and your api is bootstrapped and ready to go:

$ cd /path/to/your/mockapi/project
$ mockapi
$ npm install

Creating your own routes

While the included "Hello World" route is crazy awesome, you're bound to want to build in your own routes. It is your API, after all!

You can create all of your routes in the routes directory. For convenience, all routing modules in that directory are loaded by default into the routes variable in app.js. All you need to do is create your route definitions via express:

routes/myRoute.js

exports.get = function(req, res){
  res.json({ foo: "bar" });
};

app.js

app.get('/my/route', routes.myRoute.get);

Run the server

No surprise here, just run app.js through node:

$ node app.js

About

A quick and dirty api framework in node. Great for quickly mocking out or prototyping an api.

Resources

Stars

Watchers

Forks

Packages

No packages published