Skip to content

Commit

Permalink
serve other routes
Browse files Browse the repository at this point in the history
eg http://localhost:3000/about
  • Loading branch information
BradDenver committed Dec 31, 2014
1 parent 507b3a1 commit d7216b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
/node_modules/

/bower_components/

/dev/index.html
1 change: 0 additions & 1 deletion dev/index.html

This file was deleted.

7 changes: 6 additions & 1 deletion server.js
Expand Up @@ -21,7 +21,12 @@ var server = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true
});

// allow server to render any route
server.use('/', function(req, res) {
Router.run(Routes, req.path, function (Handler) {
res.send(React.renderToString(React.createElement(Handler, null)));
});
});
server.listen(3000, 'localhost', function (err, result) {
if (err) {
console.log(err);
Expand Down

0 comments on commit d7216b9

Please sign in to comment.