Skip to content

Commit

Permalink
feat: add build command
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwa committed May 23, 2022
1 parent 2afb72b commit 3d6fc90
Show file tree
Hide file tree
Showing 13 changed files with 5,083 additions and 59 deletions.
Empty file added CHANGELOG.md
Empty file.
53 changes: 47 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,53 @@
# vercel-quasar
Vercel builder for Quasar with SSR enabled
# useage
`pnpm i`
## 1. change listen function in your src-ssr/server.js file
### 1.1. remove all async and await
### 1.2. return { handler: ssrHandler }
``` js
/**
* You need to make the server listen to the indicated port
* and return the listening instance or whatever you need to
* close the server with.
*
* The "listenResult" param for the "close()" definition below
* is what you return here.
*
* For production, you can instead export your
* handler for serverless use or whatever else fits your needs.
*/
export function listen({ app, port, isReady, ssrHandler }) {
if (process.env.DEV) {
await isReady();
return app.listen(port, () => {
if (process.env.PROD) {
console.log('Server listening at port ' + port);
}
});
} else {
// in production
// "ssrHandler" is a prebuilt handler which already
// waits for all the middlewares to run before serving clients

`pnpm lint`
// whatever you return here is equivalent to module.exports.<key> = <value>
return { handler: ssrHandler };
}
}
```
### 1.3. example
![server.js.example.ng](https://raw.githubusercontent.com/dongwa/vercel-quasar/dev/imgs/server.js.example.png)

`pnpm fix`
## 2. Configure `vercel-quasar` as builder in `vercel.json`
### Add a `vercel.json` file in your root path
```json
{
"version": 2,
"builds": [
{
"src": "package.json",
"use": "vercel-quasar"
}
]
}

`pnpm test`

`pnpm build`
```
Binary file added imgs/server.js.example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3d6fc90

Please sign in to comment.