Dave Feldman
Dave Feldman

Reputation: 194

Automatically add/interpret trailing slashes for items in public/ directory?

Quick question about Meteor's public directory and static index.html files:

My app has a few static pages. Rather than set up a whole routing thing, I've just dropped them in subdirectories of public/. Overall it works pretty well: if I have an HTML file at <app root>/public/somedir/index.html then navigating to http://my-app.com/somedir/ will produce that page. But if I leave off the trailing slash, it doesn't work: I just end up back at the root of my app as though I'd simply navigated to http://my-app.com/.

What's the best way to deal with this?

Thanks!

Upvotes: 0

Views: 133

Answers (1)

Andrew Wilcox
Andrew Wilcox

Reputation: 1021

There's no standard way to do this in Meteor yet.

It is possible to do it yourself, if you have detailed knowledge of Meteor's internals and you know how to write express middleware :-) See the appcache package source for an example (it intercepts calls to the "/app.manifest" URL and generates its own response).

But personally, I'd just take the plunge and set up routes. Meteor is designed as a single web page framework, and it's going to be easier to develop your application using that model rather than fighting it.

Upvotes: 1

Related Questions