Comments (11)
Oh, sure, that should be return wait_for_file
instead of wait_for_file
.
Install the latest version for the fix, it should be working.
So I'm guessing you return a Koa middleware from the server()
function, and then .use()
that middleware on the main Koa app?
Or is there some way to mount a child Koa application inside a parent Koa application?
Yesterday I've also introduced an extension point for page-server
:
https://github.com/halt-hammerzeit/react-isomorphic-render/blob/33906f9f787a0bae88067aae593788a2b09a55dc/source/page-server/web%20server.js#L94-L102
Maybe it can serve your needs too.
from universal-webpack.
Awesome thanks for updating that.
For mounting, I read that you can use koa-mount to mount one koa app within
another as a middleware, but haven't actually tried it yet:
https://github.com/koajs/mount. I am going to try that and if it doesn't
work then return a koa middleware like you said. Ideally koa-mount will
work so I can use your webserver from the react-isomorphic-render project.
I'm trying to stick with your implementation as much as possible, since it
is cleaner than when I do my own.
I will check out the extension point for page-server, I think it may be
very handy.
On Wed, Jul 20, 2016 at 7:04 PM, Nikolay [email protected] wrote:
Oh, sure, that should be return wait_for_file instead of wait_for_file.
Install the latest version for the fix, it should be working.So I'm guessing your return a Koa middleware from the server() function,
and then .use() that middleware on the main Koa app?
Or is there some way to mount a child Koa application inside a parent Koa
application?Yesterday I've also introduced an extension point for page-server:
https://github.com/halt-hammerzeit/react-isomorphic-render/blob/33906f9f787a0bae88067aae593788a2b09a55dc/source/page-server/web%20server.js#L94-L102
Maybe it can serve your needs too.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABHVMTMYRYUXagVOcxrvJhqgefUBQYizks5qXrecgaJpZM4JRS22
.
from universal-webpack.
Ok.
I might also give the current page-server
architecture a thought and maybe export a server-render
function which would basically be the already present rendering function
https://github.com/halt-hammerzeit/react-isomorphic-render/blob/master/source/page-server/render.js#L18
That function would return a Promise resolving to HTML markup, and so it could be usable with anything be it Koa, Express or any other library.
That can be the task for tomorrow.
from universal-webpack.
Yes I think that would be good.
On Wed, Jul 20, 2016 at 7:21 PM, Nikolay [email protected] wrote:
Ok.
I might also give the current page-server architecture a thought and
maybe export a server-render function which would basically be the
already present rendering functionhttps://github.com/halt-hammerzeit/react-isomorphic-render/blob/master/source/page-server/render.js#L18
That function would return a Promise, and so it could be usable with
anything be it Koa, Express or any other library.
That can be the task for tomorrow.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABHVMV3wejw_FxnQjWsLLbIOFOJXC2v4ks5qXrufgaJpZM4JRS22
.
from universal-webpack.
Hi again. I am running into trouble, I think because halt-hammerzeit/web-service is using koa ^2.0.0, while halt-hammerzeit/react-isomorphic-render is using koa 1.1.2. koa-mount's current release is support koa 1.x, and they have a "next" branch supporting 2.x.
I will see if I can get this to work, but it might be worth updating react-isomorphic-render to koa 2.x at some point for consistency.
from universal-webpack.
I migrated react-isomorphic-render
to Koa v2 recently, have you updated the package?
from universal-webpack.
Oh oops I didn't notice that, thanks!
from universal-webpack.
FYI I just got everything to work, mounting the page-server within the web-service for production.
3 "gotchas" were:
- I had to use koa-mount@next version to support koa 2.x
- I had to pass detect_locale: true option when creating web-service, otherwise the mounted page-server would crash, since the ctx object passed through from the parent koa application did not have the getLocaleFromQuery() function.
- I had to make page-server/start export a function to generate the server like this:
export default () => server(configuration, settings);
And then call that function in page-server/web server.js and web-server/web server.js
Otherwise the server would get started multiple times since I need to import it in both page-server/web server.js and web-server/web server.js.
from universal-webpack.
- Yeah, that's a little gotcha
- Oh, I get it. I was going to remove that option first but seems that it has its uses. Anyway I'll extract routing in a separate middleware soon. These two days were non-stop coding and debugging (mostly fixing
react-isomorphic-render
bugs) - Didn't get the idea without the code, but I guess I don't have to.
from universal-webpack.
Extracted server-side rendering into an exported render
function in the latest version of the package.
https://github.com/halt-hammerzeit/react-isomorphic-render#without-proxying
from universal-webpack.
Removed preferred_locale
from render
function parameters.
Now it only takes the same parameters as webpage server + request
original HTTP request.
preferred_locale
is not passed in this case and it's up to the developer to detect the preferred locale.
from universal-webpack.
Related Issues (20)
- webpack-dev-server does not support es6 modules HOT 2
- support css-loader v2 HOT 7
- Error: [universal-webpack] Your server source file must export a function. Got [ 'libserver' ] HOT 7
- typescript signatures for clientConfiguration/serverConfiguration do not include options HOT 2
- Advanced config HOT 5
- webpack-chunks.json not found HOT 1
- How to config webpack-chunks.json path? HOT 3
- Compatibility with css-loader@3 broken HOT 2
- parser: { requireEnsure: false } } HOT 1
- support css loader v3 HOT 1
- [Question] SSR Support for Files like png and svg HOT 3
- webpack-isomorphic-tools to universal-webpack
- [Question] ssr bundle does not have styles
- DeprecationWarning HOT 2
- Flash of Unstyled Content with Webpack 4 HOT 2
- Nodemon causes Error 503 on Hot reload HOT 8
- Using dynamic imports causes the output filename to be the first encounted chunk name when generating server bundle HOT 4
- Fails to run server using DllPlugin, "ReferenceError: vendor is not defined"
- webpack-serve has been DEPRECATED HOT 2
- Readme is difficult to follow HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universal-webpack.