cskr/grasshopper

Problem with route <> folder

Closed this issue · 1 comments

I have the problem that I have a static folder in my app tree and a route which has the same name like the folder.

Now if I go to "localhost:3000/folder" the route fires but if I go to "localhost:3000/folder/" I get into that folder. I think this problem is connected with the commit "Don't ignore trailing /".

It would be awesome to manually define a static path instead of having them automatically, for example in express you can define what static files should be available if you go to a specific route:

app.use("/folder", express.static(__dirname + '/otherFolder'));

Which means that if you go to "localhost:3000/folder/image.jpg" you get a which stays in "/otherFolder/image.jpg"

cskr commented

Doesn't pointing to the directory containing static files by passing staticsDir to gh.config() help?

gh.configure({
    staticsDir: __dirname + '/otherFolder'
});

If you put a folder named 'folder' inside this directory, you don't need to define a route for it.