-
Notifications
You must be signed in to change notification settings - Fork 6
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
11 changed files
with
919 additions
and
623 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"scripts": { | ||
"dev": "vite", | ||
"dev": "node --trace-warnings node_modules/vite/bin/vite", | ||
"build": "vite build", | ||
"prepare": "pnpm prisma generate && pnpm prisma db push", | ||
"prod": "pnpm run build && cp ./prisma/test.db ./dist/server/node_modules/.prisma/client && cross-env NODE_ENV=production node dist/server/index.mjs" | ||
}, | ||
"dependencies": { | ||
"@hattip/adapter-node": "^0.0.42", | ||
"@brillout/json-serializer": "^0.5.8", | ||
"@hattip/adapter-node": "^0.0.45", | ||
"@hattip/router": "^0.0.45", | ||
"@hono/node-server": "^1.9.0", | ||
"@node-rs/argon2": "^1.7.2", | ||
"@prisma/client": "^5.9.1", | ||
"@types/express": "^4.17.21", | ||
|
@@ -16,15 +19,16 @@ | |
"cross-env": "^7.0.3", | ||
"express": "^4.18.2", | ||
"fastify": "^4.26.1", | ||
"hono": "^4.1.5", | ||
"prisma": "^5.9.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"sharp": "^0.33.2", | ||
"telefunc": "^0.1.71", | ||
"typescript": "^5.3.3", | ||
"vike": "^0.4.161", | ||
"vike": "0.4.161", | ||
"vike-node": "^0.0.1", | ||
"vite": "npm:@nitedani/[email protected]" | ||
"vite": "6.0.0-alpha.0" | ||
}, | ||
"type": "module" | ||
} |
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,43 @@ | ||
import { telefunc } from 'telefunc' | ||
import { vike } from 'vike-node/web' | ||
import { init } from '../database/todoItems.js' | ||
import { createAdaptorServer } from '@hono/node-server' | ||
import { Hono } from 'hono' | ||
|
||
startServer() | ||
|
||
async function startServer() { | ||
await init() | ||
const app = new Hono() | ||
|
||
app.use('/_telefunc', async (ctx) => { | ||
const httpResponse = await telefunc({ | ||
url: ctx.req.url, | ||
method: ctx.req.method, | ||
body: await ctx.req.text() | ||
}) | ||
return new Response(httpResponse.body, { | ||
status: httpResponse.statusCode, | ||
headers: { | ||
'Content-Type': httpResponse.contentType | ||
} | ||
}) | ||
}) | ||
|
||
app.use('*', async (ctx) => { | ||
const res = await vike({ | ||
url: ctx.req.url, | ||
headers: ctx.req.header() | ||
}) | ||
if (!res) return new Response('Not Found', { status: 404 }) | ||
return new Response(res.body, { | ||
status: res.status, | ||
headers: res.headers | ||
}) | ||
}) | ||
|
||
const server = createAdaptorServer(app) | ||
const port = process.env.PORT || 3000 | ||
server.listen(+port) | ||
console.log(`Server running at http://localhost:${port}`) | ||
} |
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 |
---|---|---|
|
@@ -31,8 +31,8 @@ | |
"@types/node": "^20.11.19", | ||
"fastify": "^4.26.1", | ||
"typescript": "^5.3.3", | ||
"vike": "^0.4.161", | ||
"vite": "npm:@nitedani/[email protected]" | ||
"vike": "0.4.161", | ||
"vite": "6.0.0-alpha.0" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
|
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
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
Oops, something went wrong.