grunt task runner for stubcell.
stubcell is stub server that can be defined response JSON as JSON5.
This plugin requires Grunt ~0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
$ npm install grunt-stubcell -D
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-stubcell');
This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade, but in case you can't please use v0.3.2.
'use strict';
grunt.initConfig({
stubcell: {
test: {
// entry yaml path
entry: "entry.yaml",
// base response data path
// if empty, basepath is same to entry.yaml dir
basepath: "",
// port settings
port: 3000,
// record json settings
record: {
// backend server for record json
target : "http://echo.jsontest.com",
// json store directory
basepath : "",
// debug print
debug : true,
}
}
}
});
grunt.loadNpmTasks('grunt-stubcell');
'use strict';
grunt.initConfig({
connect: {
server: {
options: {
port: 8000,
base: 'public',
logger: 'dev',
hostname: 'localhost',
middleware: function (connect, options) {
var proxy = require('grunt-connect-proxy/lib/utils').proxyRequest;
return [
// Include the proxy first
proxy,
// Serve static files.
connect.static(options.base),
// Make empty directories browsable.
connect.directory(options.base)
];
}
},
},
// proxy settings for stubcell
proxies: [
{
context: '/api',
port: 3000,
}
],
},
stubcell: {
test: {
// entry yaml path
entry: "entry.yaml",
// base response data path
// if empty, basepath is same to entry.yaml dir
basepath: "",
// port settings
port: 3000,
// record json settings
record: {
// backend server for record json
target : "http://echo.jsontest.com",
// json store directory
basepath : "",
// debug print
debug : true,
}
}
}
});
grunt.loadNpmTasks('grunt-stubcell');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-connect-proxy');
grunt.task.run([
// configureProxies is needed
"configureProxies",
"connect",
"stubcell",
"watch"
]);