Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yosuke-furukawa/gulp-stubcell
stub server for gulp
https://github.com/yosuke-furukawa/gulp-stubcell
Last synced: about 1 month ago
JSON representation
stub server for gulp
- Host: GitHub
- URL: https://github.com/yosuke-furukawa/gulp-stubcell
- Owner: yosuke-furukawa
- Created: 2014-05-06T15:52:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:56:18.000Z (11 months ago)
- Last Synced: 2024-09-19T01:25:12.167Z (about 2 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
gulp-stubcell [![build status](https://secure.travis-ci.org/yosuke-furukawa/gulp-stubcell.png)](http://travis-ci.org/yosuke-furukawa/gulp-stubcell)
--------------------------stubcell for gulp
## Install
```
npm install gulp-stubcell -D
```## Usage
### simple
```js
var gulp = require('gulp'),
stubcell = require('gulp-stubcell');gulp.task('stubcell', function() {
stubcell.start({
// entry yaml path, default is entry.yml
entry: 'entry.yml',
// dummy response base dir
basepath : '',
// stubcell port
port: 3000,
// show more info
debug: false,
// recording settings
record : {
// request delegate to
proxy : 'http://localhost:3001',
}
});
});gulp.task('default', ['stubcell']);
```### with connect
```js
var gulp = require('gulp');
var stubcell = require('gulp-stubcell');
var connect = require('gulp-connect');
var proxy = require('proxy-middleware');
var url = require('url');gulp.task('connect', function() {
connect.server({
root: ['build'],
port: 9000,
livereload: true,
middleware: function(connect, o) {
return [ (function() {
var options = url.parse('http://localhost:3000/test');
options.route = '/test';
return proxy(options);
})() ];
}
});
});gulp.task('stubcell', function() {
stubcell.start({
// entry yaml path, default is entry.yml
entry: 'entry.yml',
// dummy response base dir
basepath : '',
// stubcell port
port: 3000,
// recording settings
record : {
// request delegate to
proxy : 'http://localhost:3001',
}
});
});gulp.task('default', ['connect', 'stubcell']);
gulp.task('default', ['start']);
```