-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
292 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// https://vike.dev/onBeforeRender | ||
export default function data() { | ||
return { | ||
d: String(new Date()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export async function getHello() { | ||
return 'hello' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import { Hono } from 'hono' | ||
import vike from 'vike-node/hono' | ||
import { telefunc, config } from 'telefunc' | ||
config.disableNamingConvention = true | ||
|
||
const app = new Hono() | ||
app.post('_telefunc', async (ctx) => { | ||
const { url, method } = ctx.req | ||
const body = await ctx.req.text() | ||
const httpResponse = await telefunc({ url, method, body }) | ||
return new Response(httpResponse.body, { | ||
status: httpResponse.statusCode | ||
}) | ||
}) | ||
app.use(vike()) | ||
export default app | ||
console.log('import.meta.env.SSR app', import.meta.env.SSR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
import react from '@vitejs/plugin-react' | ||
import vike from 'vike/plugin' | ||
import { telefunc } from 'telefunc/vite' | ||
import vikeNode from 'vike-node/plugin' | ||
import { pages } from 'vike-cloudflare' | ||
import vike from 'vike/plugin' | ||
|
||
export default { | ||
plugins: [ | ||
react(), | ||
vike({ prerender: true }), | ||
vikeNode({ entry: 'server/node-entry.js' }), | ||
pages({ | ||
server: { | ||
kind: 'hono', | ||
entry: 'server/app.js' | ||
vikeNode({ | ||
entry: { | ||
index: 'server/node-entry.js', | ||
cloudflare: { | ||
entry: 'server/app.js', | ||
runtime: 'cloudflare', | ||
scaffold: 'dist/cloudflare' | ||
} | ||
} | ||
}) | ||
}), | ||
react(), | ||
telefunc() | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
name = "vike-cloudflare-hono-demo" | ||
compatibility_date = "2024-06-24" | ||
pages_build_output_dir = "./dist/cloudflare" | ||
compatibility_flags = [ "nodejs_compat" ] | ||
pages_build_output_dir = "./dist/cloudflare" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import type { Runtime } from '../types.js' | ||
|
||
export const RUNTIMES: Runtime[] = ['node', 'nodeless', 'deno', 'cloudflare', 'vercel'] | ||
export const RUNTIMES: Runtime[] = ['node', 'nodeless', 'deno', 'cloudflare', 'cloudflare-nodejs-compat', 'vercel'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.