nuǝW pǝuoᴉʇᴉsoԀ ʎlǝʌᴉʇɐƃǝN
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

gulp-serve

1.4.0 • Public • Published

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

3,102

version

1.4.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability