-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can it run in conjunction with grunt-server on the same port? #1
Comments
It can't run on the same port, but I am using grunt to manage everything. Here's the Gruntfile I've been using. Not the prettiest but it gets the job done: var exec = require('child_process').exec;
module.exports = function(grunt) {
grunt.initConfig({
concat: {
options: {
separator: grunt.util.linefeed,
},
blueprint: {
src: ['parts/*.md'],
filter: 'isFile',
dest: 'blueprint.md',
},
},
shell: {
docs: {
command: function() {
var port = grunt.option('p') || '3002';
var templateFile = grunt.option('t') || 'templates/flatly-multi.jade';
var inputFile = grunt.option('i') || './blueprint.md';
var all = grunt.option('a');
if (all) {
console.log('Merging blueprint...');
grunt.task.run('concat:blueprint');
inputFile = './blueprint.md';
}
return 'aglio -t ' + templateFile + ' -i ' + inputFile + ' -s' + ' -p ' + port;
},
options: {
stdout: true,
stderr: true
}
},
mock: {
command: function() {
var port = grunt.option('p') || '3001';
var inputFile = grunt.option('i') || './blueprint.md';
var all = grunt.option('a');
if (all) {
console.log('Merging blueprint...');
grunt.task.run('concat:blueprint');
inputFile = './blueprint.md';
}
return './node_modules/api-mock/bin/api-mock ' + inputFile + ' -p ' + port;
},
options: {
stdout: true,
stderr: true
}
},
test: {
command: function() {
var endpoint = grunt.option('e') || 'http://localhost:3001/';
var inputFile = grunt.option('i') || './blueprint.md';
var all = grunt.option('a');
if (all) {
console.log('Merging blueprint...');
grunt.task.run('concat:blueprint');
inputFile = './blueprint.md';
}
return './node_modules/dredd/bin/dredd ' + inputFile + ' ' + endpoint + ' --sorted -h Accept:application/json';
},
options: {
stdout: true,
stderr: true
}
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('docs', 'Launch the documentation server.', ['shell:docs']);
grunt.registerTask('mock', 'Launch a mock server generated by the blueprint.', ['shell:mock']);
grunt.registerTask('test', 'Run automated tests against the API.', ['shell:test']);
grunt.registerTask('merge', 'Merge the parts of the api together.', ['concat:blueprint']);
grunt.registerTask('default', ['docs']);
}; I was planning to make an example skeleton project of our blueprint/tooling, but here's a quick rundown:
The part relevant to your question is the |
Thanks, But is there a way that I can fire up a developing environment sort of grunt-server and will have the mock api's work natively and not have cross-origin issues, without CORS etc. |
@adardesign I may not understand your question, then. What are you trying to do? |
Im trying to create a development environment where I can use mockAPI's easily and in the same-origin by simply firing up a grunt task which it:
Thanks! |
sort of, but now need to wire Thanks! |
Can it run in conjunction with grunt-server on the same port?
How would I fire it up via a gruntTask?
The text was updated successfully, but these errors were encountered: