Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    gulp-servepublic

    gulp-serve

    Circle CI Downloads

    Provide connect-server functionality, using connect.static

    Install

    Install with npm

    npm i --save-dev gulp-serve
    

    Usage

    var gulp = require('gulp');
    var serve = require('gulp-serve');
     
    gulp.task('serve', serve('public'));
    gulp.task('serve-build', serve(['public', 'build']));
    gulp.task('serve-prod', serve({
      root: ['public', 'build'],
      port: 80,
      middleware: function(req, res) {
        // custom optional middleware
      }
    }));

    With HTTPS enabled (using built-in key and certificate for localhost):

    var gulp = require('gulp');
    var serve = require('gulp-serve');
     
    gulp.task('serve', serve('public'));
    gulp.task('serve-build', serve(['public', 'build']));
    gulp.task('serve-prod', serve({
      root: ['public', 'build'],
      port: 443,
      https: true,
      middleware: function(req, res) {
        // custom optional middleware
      }
    }));

    With HTTPS enabled (using self provided key and certificate):

    var gulp = require('gulp');
    var serve = require('gulp-serve');
     
    gulp.task('serve', serve('public'));
    gulp.task('serve-build', serve(['public', 'build']));
    gulp.task('serve-prod', serve({
      root: ['public', 'build'],
      port: 443,
      https: {
        key: 'path/to/cert.key',
        cert: 'path/to/cert.pem'
      },
      middleware: function(req, res) {
        // custom optional middleware
      }
    }));

    License

    MIT

    install

    npm i gulp-serve

    Downloadsweekly downloads

    2,966

    version

    1.4.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar