I am trying use restify to serve all paths that don't begin with /api
from a directory containing static files.
var restify = require('restify');
var server = restify.createServer();
server.get(/^\/(?!api)/, restify.serveStatic({
directory: './static'
}));
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
});
But, when I attempt going to, say, http://0.0.0.0:8080/index.html
, I get:
{"code":"InternalError","message":"Invalid regular expression: /^/(?!a/: Unterminated group"}
I am doubly confused because:
$ node
> var e = /^\/(?!api)/;
undefined
> e.test('/api/v1');
false
> e.test('/index.html');
true