Skip to content

Instantly share code, notes, and snippets.

@natural-affinity
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save natural-affinity/f48da18cac92e53248a2 to your computer and use it in GitHub Desktop.

Select an option

Save natural-affinity/f48da18cac92e53248a2 to your computer and use it in GitHub Desktop.
Fetch JSON from express server API via grunt-curl with command-line args
module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    slug: grunt.option('slug'),
    curl: {
      json: {
        src: 'http://0.0.0.0:<%= express.options.port %>/api/clients/<%= slug %>',
        dest: 'uploads/<%= slug %>/client.json'
      }
    }
  });

  //usage: grunt --slug=acme
  grunt.registerTask('default', ['curl:json']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment