I'm trying to get Koa to isomorphically render a html string it receives from react-router.

Here's the code I've been trying to make work:

server.js

import koa from 'koa'; import React from "react"; import Router from "react-router"; import routes from "./routes"; const server = koa(); const port = process.env.NODE_ENV || 8000; server.use(function *() { try { yield Router.run(routes, this.request.url, function (Handler) { var content = React.renderToString(<Handler/>) this.body = content }) } catch (err) { this.status = err.status || 500; this.body = err.message; this.app.emit('error', err, this); } }) server.listen(port, function(err) { if (err) throw err; console.log("Server running on: http://localhost:"+port) })

routes.js

import React from "react" import {Route, DefaultRoute} from "react-router" import Main from "./components/main" export default ( <Route path="/"> <DefaultRoute handler={Main} name="main" /> </Route> )

main.js

import React from "react" const Main = React.createFactory(React.createClass ({ render () { return ( <div>HELLO</div> ) } })) export default Main

Getting several errors: