-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
5,083 additions
and
59 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.