Skip to content

Commit

Permalink
Modified folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Seven committed Oct 25, 2016
1 parent e7568da commit 148031d
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# koa-simple-isomorphic
# koa2-simple-isomorphic

> A simple isomorphic React for koa2.
Expand Down
2 changes: 1 addition & 1 deletion bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require('babel-core/register');
require('babel-polyfill');

if(process.env.NODE_ENV === 'development') {
require('../server.js');
require('../src/server.js');
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "koa-simple-isomorphic",
"name": "koa2-simple-isomorphic",
"version": "1.0.1",
"description": "simple koa server-render",
"description": "simple koa2 server-side-render",
"main": "index.js",
"scripts": {
"start": "PORT=8000 NODE_ENV=development nodemon ./bin/run",
Expand Down Expand Up @@ -32,16 +32,21 @@
"mocha": "2.5.3",
"nodemon": "1.10.0",
"passport": "0.3.2",
"passport-local": "1.0.0"
"passport-local": "1.0.0",
"webpack": "2.1.0-beta.4",
"webpack-dev-server": "2.0.0-beta"
},
"dependencies": {
"electrode-react-ssr-caching": "^0.1.3",
"koa-csrf": "2.4.0",
"koa-logger": "1.3.0",
"koa-router": "7.0.1",
"koa-session": "3.3.1",
"react": "15.1.0",
"react-dom": "15.1.0",
"react-redux": "^4.4.5",
"react-router": "2.4.1",
"redux": "^3.6.0",
"supertest": "1.2.0"
}
}
2 changes: 1 addition & 1 deletion app/components/About.js → src/components/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class About extends Component {
return (
<div>
<IndexLink className="btn btn-default" Link to="/">Home</IndexLink >
<p>About</p>
<p>About</p>
</div>
);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions config/render.js → src/config/render.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import routes from '../app/app';
import routes from '../routes';

export default async (ctx) => {
const initialState = {
Expand All @@ -26,8 +26,8 @@ export default async (ctx) => {
ctx.throw(404, 'Not found');
}
});
await ctx.render('index', {

await ctx.render('index', {
reactContent: ctx.state.reactContent
});
}
}
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions server.js → src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ const app = module.exports = new koa();
import koaConfig from './config/koaConfig';
koaConfig(app, process.env.NODE_ENV, passport);

//routes
import routes from './config/routes';
routes(app);

//router
import router from './config/router';
router(app);

app.listen(process.env.PORT || 3000, () => {
console.log(`Server is running at ${process.env.PORT}!`);
Expand Down

0 comments on commit 148031d

Please sign in to comment.