Skip to content

Commit

Permalink
Add editor frontend HTML response with GET /
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Oct 20, 2024
1 parent 20b6cfc commit 00ae72c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontends/server/frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pnpm-debug.log*
lerna-debug.log*

node_modules
dist
#dist
dist-ssr
*.local

Expand Down
1 change: 1 addition & 0 deletions frontends/server/frontend/dist/assets/index-BqmNs24i.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions frontends/server/frontend/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lem</title>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/destyle.css" />
<style rel="stylesheet">
html, body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}

</style>
<script type="module" crossorigin src="/assets/index-BqmNs24i.js"></script>
</head>
<body>
<div id='lem-editor'></div>
</body>
</html>
14 changes: 13 additions & 1 deletion frontends/server/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@

(defun clack-handler (env)
(unless (wsd:websocket-p env)
'(200 () ("ok"))))
(let ((path (getf env :path-info)))
(cond ((string= "/" path)
`(200 (:content-type "text/html")
,(asdf:system-relative-pathname :lem-server
#p"frontend/dist/index.html")))
((alexandria:starts-with-subseq "/assets/" path)
`(200 (:content-type "application/javascript")
,(asdf:system-relative-pathname :lem-server
(format nil
"frontend/dist/~A"
(string-left-trim "/" path)))))
(t
'(200 () ("ok")))))))

;;;
(defclass stdio-server-runner (server-runner)
Expand Down

0 comments on commit 00ae72c

Please sign in to comment.