-
-
Save goje87/8aa5c04bf3b0f5de907d to your computer and use it in GitHub Desktop.
Serving static content in iron-router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var routerCounfiguration = { | |
layoutTemplate: 'mainLayout', | |
notFoundTemplate: 'notFoundTemplate' | |
}; | |
Router.configure(routerCounfiguration); | |
Router.map(function() { | |
this.route('home', { | |
path: '/' | |
}); | |
this.route('public', { | |
path: '/public/:path(*)', | |
where: 'server', | |
action: function() { | |
this.response.write('hello world'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If it's still relevant, here's the code I use:
(notice that I use synchronous functions, so the code gets blocked every time a file is being read, so don't forget to adjust it to your needs as necessary)