docs + various polish

This commit is contained in:
Jacky Zhao 2023-07-09 19:32:24 -07:00
parent b90590b9f4
commit 08f8e3b4a4
49 changed files with 1365 additions and 196 deletions
quartz

View file

@ -54,21 +54,16 @@ export default async function buildQuartz(argv: Argv, version: string) {
if (argv.serve) {
const server = http.createServer(async (req, res) => {
let status = 200
const result = await serveHandler(req, res, {
await serveHandler(req, res, {
public: output,
directoryListing: false,
}, {
async sendError() {
status = 404
},
})
const status = res.statusCode
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}`)
console.log(chalk.cyan(`Started a Quartz server listening at http://localhost:${argv.port}`))
console.log('hint: exit with ctrl+c')
}
}