-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { Switch, Route } from 'react-router-dom'; | ||
|
||
import parseRoute from 'react/util/parseRoute'; | ||
|
||
import ProfilePage from 'react/pages/profile/ProfilePage'; | ||
|
||
export default () => ( | ||
<Switch> | ||
<Route | ||
path="/profile/:id" | ||
render={parseRoute(({ params }) => <ProfilePage id={params.id} />)} | ||
/> | ||
</Switch> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extends ../../components/layout/index | ||
|
||
block meta | ||
!= apollo.styles | ||
|
||
block body | ||
#apolloMount.Constrain | ||
!= apollo.html | ||
|
||
block scripts | ||
script. | ||
window.__APOLLO_STATE__ = !{JSON.stringify(apollo.state).replace(/</g, '\\u003c')}; | ||
script( src= asset('/assets/profile.js') ) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import express from 'express'; | ||
|
||
import apolloMiddleware from 'react/apollo/middleware'; | ||
|
||
import Routes from 'apps/profile/Routes'; | ||
import withStaticRouter from 'react/hocs/WithStaticRouter'; | ||
|
||
const app = express(); | ||
|
||
app | ||
.set('views', __dirname) | ||
.set('view engine', 'jade') | ||
|
||
.get('/profile/:id', apolloMiddleware, (req, res, next) => { | ||
req.apollo.render(withStaticRouter(Routes)) | ||
.then((apollo) => { | ||
res.render('index', { apollo }); | ||
}) | ||
.catch(next); | ||
}); | ||
|
||
module.exports = app; |