Skip to content

Commit

Permalink
Merge pull request #50 from netlify/cleanPaths
Browse files Browse the repository at this point in the history
add support for http-server
  • Loading branch information
swyxio authored Oct 11, 2018
2 parents 4526939 + 269f57d commit d739bb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ function promiseCallback(promise, callback) {

function createHandler(dir) {
return function(request, response) {
var func = request.path.split("/").filter(function(e) {
// handle proxies without path re-writes (http-servr)
var cleanPath = request.path.replace(/^\/.netlify\/functions/, '')

var func = cleanPath.split("/").filter(function(e) {
return e;
})[0];
var module = path.join(process.cwd(), dir, func);
Expand Down

0 comments on commit d739bb3

Please sign in to comment.