Skip to content

Commit

Permalink
feat: genRelation in cold start
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumbiu committed Dec 1, 2023
1 parent 4f9f1c4 commit 2da1540
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/late-crews-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'truth-cli': patch
---

make relations cold start
2 changes: 1 addition & 1 deletion packages/cli/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export function startWebServer(port: number = 3003) {
if (Number.isNaN(port)) throw new TypeError('illegal type of [port]')
const begin = Date.now()
const html = readFileSync(htmlPath)
const relations = gzipSync(JSON.stringify(genRelations()))
const server = createServer((req, res) => {
if (req.url === '/') {
res.setHeader('content-encoding', 'br')
res.end(html)
} else if (req.url === '/base.json') {
const relations = gzipSync(JSON.stringify(genRelations()))
res.setHeader('content-encoding', 'gzip')
res.end(relations)
}
Expand Down

1 comment on commit 2da1540

@vercel
Copy link

@vercel vercel bot commented on 2da1540 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.