serve-api
Serve middleware for mocking api
Usage
// expressvar express = var serveApi = var app = appapp
// dong-queuevar Queue = var serveApi = var queue = queue http
Mocking
Searching for js and json files in the directory
Pattern
<URL>
: Request URL, without query string.<METHOD>
: RESTful request method,such asPOST|PATCH|PUT|DELETE|GET
, and*
matches all methods.<VALUE>
: Response text, could be json or string.
Examples
moduleexports = '/foo/bar': { // do something with url and query return code: 0 message: 'ok' ; } ;
moduleexports = '/foo/bar': '*': code: 0 message: 'ok' ;
// for redirect, etc