Skip to content

Commit

Permalink
pressr script
Browse files Browse the repository at this point in the history
  • Loading branch information
grgur committed Oct 12, 2020
1 parent 3c01725 commit 7c4e147
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ Test in:
npm install
```

### Create a server-side-rendered build
### Create and test a server-side-rendered build

```
npm run ssr
```

\*Note: The `pressr` script will create a SSR build before running `src/server.js`.

### Compiles and hot-reloads for development

```
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"ssr": "cross-env SSR=true vue-cli-service build",
"pressr": "cross-env SSR=true vue-cli-service build",
"ssr": "node src/server.js",
"lint": "vue-cli-service lint"
},
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ server.get("*", async (req, res) => {
${appContent}
</body>
</html>
`;

res.end(html);
});

console.log(`
You can navigate to http://localhost:8080
`);

server.listen(8080);

0 comments on commit 7c4e147

Please sign in to comment.