From 38cff2d670ecf7fd325aaaf776a4c250a72cc661 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 04 Jul 2023 23:48:36 +0000
Subject: [PATCH] more visual polish, adjust colours and spacing
---
quartz/build.ts | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/quartz/build.ts b/quartz/build.ts
index 60a1a51..45595e7 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -57,10 +57,18 @@
if (argv.serve) {
const server = http.createServer(async (req, res) => {
- return serveHandler(req, res, {
+ let status = 200
+ const result = await serveHandler(req, res, {
public: output,
directoryListing: false,
+ }, {
+ async sendError() {
+ status = 404
+ },
})
+ const statusString = status === 200 ? chalk.green(`[${status}]`) : chalk.red(`[${status}]`)
+ console.log(statusString + chalk.grey(` ${req.url}`))
+ return result
})
server.listen(argv.port)
console.log(`Started a Quartz server listening at http://localhost:${argv.port}`)
--
Gitblit v1.10.0