Skip to content

Instantly share code, notes, and snippets.

View stevenvachon's full-sized avatar

Steven Vachon stevenvachon

View GitHub Profile
// This is just an extension of https://github.com/gruntjs/grunt-contrib-connect#middleware
grunt.initConfig({
connect: {
server: {
options: {
middleware: function(connect, options) {
var middlewares = [];
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
@alessioalex
alessioalex / sendfile.js
Created March 13, 2012 17:49 — forked from pgriess/sendfile.js
Using sendfile(2) with NodeJS
var assert = require('assert');
var net = require('net');
var open = process.binding('fs').open;
var sendfile = process.binding('fs').sendfile;
if (process.argv.length < 4) {
console.error('usage: sendfile <port> <path>');
process.exit(1);
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//