-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
56 lines (47 loc) · 1.44 KB
/
server.js
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
/*import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";
import {
createCookie,
createWorkersKVSessionStorage,
} from "@remix-run/cloudflare";
import * as build from "@remix-run/dev/server-build";
const handleRequest = createPagesFunctionHandler({
build,
mode: process.env.NODE_ENV,
getLoadContext: (context) => {
const sessionStorage = createWorkersKVSessionStorage({
kv: context.env.SESSION_STORAGE,
cookie: createCookie("__session", {
secrets: ["r3m1xr0ck5"],
sameSite: true,
secure: true,
path: '/'
}),
});
return { env: context.env, sessionStorage };
}
});
export function onRequest(context) {
return handleRequest(context);
}*/
import { logDevReady, createWorkersKVSessionStorage, createCookie } from "@remix-run/cloudflare";
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";
import * as build from "@remix-run/dev/server-build";
if (process.env.NODE_ENV === "development") {
logDevReady(build);
}
export const onRequest = createPagesFunctionHandler({
build,
mode: process.env.NODE_ENV,
getLoadContext: (context) => {
const sessionStorage = createWorkersKVSessionStorage({
kv: context.env.SESSION_STORAGE,
cookie: createCookie("__session", {
secrets: ["r3m1xr0ck5"],
sameSite: true,
secure: true,
path: '/'
}),
});
return { env: context.env, sessionStorage };
}
});