Monday, 8 May 2017

Serve static files with Express

I'm trying to add a sitemap to a Express project with EJS set as it's engine.

The problem is my app does not allow a .html or .xml file to be in the path because of express.

I tried to set a public path but this crashed my app and seemed overly complicated:

app.use(express.static(path.join(__dirname, 'public')));

How would I go about simply adding a route to allow a .xml render?

Thanks!



via AndrewLeonardi

No comments:

Post a Comment