Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Commit

Permalink
Make sure OPTIONS for the root does not default.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Oct 25, 2011
1 parent cf34dd4 commit 04c44e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion photo-server.js
Expand Up @@ -50,7 +50,7 @@ app.get(/^\/photos\/(\d+)$/, getPhoto);
app.get(/^\/photos\/(\d+)\/faces$/, getFaces);
app.get(/^\/photos\/(\d+)\/faces\/(\d+)$/, getFace);
app.get(/^\/photos\/(\d+)\/persons\/(\d+)$/, getPerson);
app.options(/^\/([\d\w\/]+)$/, getDescription);
app.options(/^\/([\d\w\/]*)$/, getDescription);


/*** handlers ***/
Expand Down Expand Up @@ -102,6 +102,9 @@ function getPerson(req, res, next) {
}

function getDescription(req, res, next) {
if(!req.params[0].length)
return respond.withText(res, '', 'text/n3');

var uriPattern = new RegExp(req.params[0].replace(/\//g, '-')
.replace(/\d+/g, 'id') + '.*');
fs.readdir('descriptions', function (err, fileNames) {
Expand Down

0 comments on commit 04c44e6

Please sign in to comment.