Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add koa/express support #99

Open
i5ting opened this issue Nov 12, 2019 · 3 comments
Open

add koa/express support #99

i5ting opened this issue Nov 12, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@i5ting
Copy link
Contributor

i5ting commented Nov 12, 2019

  • add packages/middleware,package name:ssr-middleware
  • add koa/koa middlwares

example

const conf = require('./config/config.ssr')
const ssr = require('egg-react-ssr').koa(conf);

const Koa = require('koa');
const app = new Koa();

//  mount routes from config
app.use(ssr)

// ctx.ssrRender()
app.use(async ctx => {
  ctx.ssrRender(...);
});

app.listen(3000);
@i5ting i5ting added the enhancement New feature or request label Nov 12, 2019
@i5ting
Copy link
Contributor Author

i5ting commented Nov 12, 2019

上面的方案,解决了product问题

单还存在一个dev时候的问题

  • proxy
  • static

这个有更好的解法么?

@i5ting
Copy link
Contributor Author

i5ting commented Nov 12, 2019

app.use(ssr.dev())

@JohannLai
Copy link
Contributor

这个方案做得很好很认真,期待支持 koa ~ 💯

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants