Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ zero.db*

# sst
.sst
.vercel
14 changes: 14 additions & 0 deletions api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Hono } from "hono";
import { handleLogin } from "../server/login.ts";
import { handleMutate } from "../server/mutate.ts";
import { handleQuery } from "../server/query.ts";

const app = new Hono().basePath("/api");

app.get("/login", handleLogin);

app.post("/mutate", async (c) => c.json(await handleMutate(c)));

app.post("/query", async (c) => c.json(await handleQuery(c)));

export default app;
4 changes: 4 additions & 0 deletions api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig.base.json",
"include": ["./**/*", "../server/**/*", "../shared/**/*"]
}
12 changes: 6 additions & 6 deletions app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useQuery, useZero } from "@rocicorp/zero/solid";
import Cookies from "js-cookie";
import { createEffect, createSignal, For, Show } from "solid-js";
import { formatDate } from "./date";
import { randInt } from "./rand";
import { randomMessage } from "./test-data";
import { queries } from "../shared/queries";
import { mutators } from "../shared/mutators";
import { Status } from "./Status";
import { mutators } from "../shared/mutators.ts";
import { queries } from "../shared/queries.ts";
import { formatDate } from "./date.ts";
import { randInt } from "./rand.ts";
import { Status } from "./Status.tsx";
import { randomMessage } from "./test-data.ts";

function App() {
const zero = useZero();
Expand Down
4 changes: 3 additions & 1 deletion app/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ const signedCookie = Cookies.get("auth");
const userID = signedCookie ? signedCookie.split(".")[0] : "anon";
const context = signedCookie ? { userID } : undefined;

const cacheURL = import.meta.env.VITE_PUBLIC_ZERO_CACHE_URL;

const root = document.getElementById("root");

render(
() => (
<ZeroProvider
{...{
cacheURL: import.meta.env.VITE_PUBLIC_ZERO_CACHE_URL,
cacheURL,
schema,
userID,
context,
Expand Down
4 changes: 2 additions & 2 deletions app/test-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randBetween, randID, randInt } from "./rand";
import { Medium, Message, User } from "../shared/schema";
import type { Medium, Message, User } from "../shared/schema.ts";
import { randBetween, randID, randInt } from "./rand.ts";

const requests = [
"Hey guys, is the zero package ready yet?",
Expand Down
Loading