Commit be664aa70bb6cedfcb8982443b894732ba2c4d12
1 parent
0b8442ed
rm unrelated files
Showing
2 changed files
with
0 additions
and
36 deletions
Show diff stats
examples/entry-server.js deleted
1 | -import { createApp } from './main'; | |
2 | - | |
3 | -export default context => { | |
4 | - return new Promise((resolve, reject) => { | |
5 | - const { app, router } = createApp(); | |
6 | - router.push(context.url) | |
7 | - router.onReady(() => { | |
8 | - const matchedComponents = router.getMatchedComponents(); | |
9 | - if (!matchedComponents.length) { | |
10 | - reject({ code: 404 }); | |
11 | - } | |
12 | - resolve(app); | |
13 | - }, reject); | |
14 | - }); | |
15 | -}; | |
16 | 0 | \ No newline at end of file |
server.js deleted
1 | -const createApp = require('./dist/iview.ssr.js'); | |
2 | -const server = require('express')(); | |
3 | -const renderer = require('vue-server-renderer').createRenderer(); | |
4 | - | |
5 | -server.get('*', (req, res) => { | |
6 | - const context = { url: req.url }; | |
7 | - createApp(context).then(app => { | |
8 | - renderer.renderToString(app, (err, html) => { | |
9 | - if (err) { | |
10 | - if (err.code === 404) { | |
11 | - res.status(404).end('Page not found') | |
12 | - } else { | |
13 | - res.status(500).end('Internal Server Error') | |
14 | - } | |
15 | - } else { | |
16 | - res.end(html); | |
17 | - } | |
18 | - }); | |
19 | - }); | |
20 | -}); | |
21 | -server.listen(2333); | |
22 | 0 | \ No newline at end of file |