create-evikit 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
- package/src/routes/api/server.js +1 -1
- package/src/routes/api/todo/server.js +23 -21
- package/src/routes/page.js +2 -2
- /package/src/{app.js → prerender.js} +0 -0
package/index.html
CHANGED
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile } from "node:fs/promises";
|
|
|
4
4
|
import swaggerUi from "swagger-ui-express";
|
|
5
5
|
|
|
6
6
|
import { api } from "./src/api.js";
|
|
7
|
-
import { prerender } from "./src/
|
|
7
|
+
import { prerender } from "./src/prerender.js";
|
|
8
8
|
|
|
9
9
|
const app = express();
|
|
10
10
|
app.use("/static", express.static("./static"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-evikit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "bin/create-evikit.js",
|
|
6
6
|
"scripts": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"accept-language": "^3.0.20",
|
|
38
38
|
"classnames": "^2.5.1",
|
|
39
39
|
"cross-env": "^10.1.0",
|
|
40
|
-
"evikit": "^2.
|
|
40
|
+
"evikit": "^2.11.0",
|
|
41
41
|
"express": "^5.2.1",
|
|
42
42
|
"file-type": "^22.1.1",
|
|
43
43
|
"hoofd": "^1.7.3",
|
package/src/routes/api/server.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { endpoint, json, redirect } from "evikit/server";
|
|
2
|
-
|
|
3
|
-
import { db } from "../../../lib/db/index.js";
|
|
4
|
-
import { TodoGet, TodoPost } from "./types.js";
|
|
5
|
-
|
|
6
|
-
export const TodoServer = {
|
|
7
|
-
get: endpoint(TodoGet, async () =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { endpoint, json, redirect } from "evikit/server";
|
|
2
|
+
|
|
3
|
+
import { db } from "../../../lib/db/index.js";
|
|
4
|
+
import { TodoGet, TodoPost } from "./types.js";
|
|
5
|
+
|
|
6
|
+
export const TodoServer = {
|
|
7
|
+
get: endpoint(TodoGet, async () =>
|
|
8
|
+
json({ Todo: db.Todo.select({ order: { createdAt: { desc: true } } }) }),
|
|
9
|
+
),
|
|
10
|
+
|
|
11
|
+
post: endpoint(TodoPost, async ({ input }) => {
|
|
12
|
+
const [todo] = db.Todo.select({ where: { text: input.text } });
|
|
13
|
+
if (todo) {
|
|
14
|
+
db.Todo.update({
|
|
15
|
+
set: { doneAt: todo.doneAt ? undefined : Date.now() },
|
|
16
|
+
where: { text: todo.text },
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
db.Todo.upsert({ createdAt: Date.now(), text: input.text });
|
|
20
|
+
}
|
|
21
|
+
return redirect("/todo", 302);
|
|
22
|
+
}),
|
|
23
|
+
};
|
package/src/routes/page.js
CHANGED
|
@@ -220,9 +220,9 @@ npm run dev
|
|
|
220
220
|
|
|
221
221
|
h(
|
|
222
222
|
Code,
|
|
223
|
-
{ file: data?.File["src/
|
|
223
|
+
{ file: data?.File["src/prerender.js"], lang: "js", tag: "details" },
|
|
224
224
|
span(null, "src/"),
|
|
225
|
-
b(null, "
|
|
225
|
+
b(null, "prerender.js"),
|
|
226
226
|
),
|
|
227
227
|
|
|
228
228
|
h(
|
|
File without changes
|