Unlisted
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

CHANGELOG

  • JWT for authentication and sessions, eliminating need for sessionDB and loginDB to track issued tokens.
  • New userListDB containing users, tracked by a new uid parameter instead of email. Also tracks date created and last seen.
  • New /account page, enabling users to change email and delete account.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/** @jsxImportSource https://esm.sh/hono@4.0.8/jsx **/
import { Hono } from "npm:hono@4.0.8";
import { jsxRenderer } from "npm:hono@4.0.8/jsx-renderer";
import { createRoute, deleteRoute, editRoute, homeRoute } from "https://esm.town/v/peterqliu/vt_app_v2_crud_routes";
import {
accountRoute,
deleteAccountRoute,
resetEmailRoute,
} from "https://esm.town/v/peterqliu/vt_app_v2_account_routes";
import { authRoute, loginRoute, logoutRoute } from "https://esm.town/v/peterqliu/vt_app_v2_auth_routes";
const app = new Hono();
app.use(
jsxRenderer((c) => {
console.log(c);
const { children } = c;
return (
<html>
<head>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
/>
<title>VT App v2</title>
</head>
<body>
<main class="container">
{children}
</main>
</body>
</html>
);
}),
);
// authentication endpoints
app.route("/login", loginRoute);
app.route("/authenticate", authRoute);
app.route("/logout", logoutRoute);
// content endpoints
app.route("/", homeRoute);
app.route("/create", createRoute);
app.route("/edit", editRoute);
app.route("/delete", deleteRoute);
// user account endpoints
app.route("/account", accountRoute);
app.route("/resetEmail", resetEmailRoute);
app.route("/deleteAccount", deleteAccountRoute);
export default app.fetch;
peterqliu-vt_app_v2.web.val.run
August 30, 2024