updated examples

This commit is contained in:
dswbx
2024-11-23 11:21:25 +01:00
parent 2433833ad0
commit f70e2b2e10
13 changed files with 74 additions and 64 deletions

View File

@@ -4,6 +4,8 @@
"private": true,
"scripts": {
"dev": "next dev",
"db": "turso dev --db-file test.db",
"db:check": "sqlite3 test.db \"PRAGMA wal_checkpoint(FULL);\"",
"build": "next build",
"start": "next start",
"lint": "next lint"

View File

@@ -9,51 +9,7 @@ export default serve({
connection: {
type: "libsql",
config: {
url: process.env.DB_URL!,
authToken: process.env.DB_AUTH_TOKEN!
url: "http://localhost:8080"
}
}
}); /*
let app: App;
async function getApp() {
if (!app) {
app = App.create({
connection: {
type: "libsql",
config: {
url: process.env.DB_URL!,
authToken: process.env.DB_AUTH_TOKEN!
}
}
});
await app.build();
}
return app;
}
function getCleanRequest(req: Request) {
// clean search params from "route" attribute
const url = new URL(req.url);
url.searchParams.delete("route");
return new Request(url.toString(), {
method: req.method,
headers: req.headers,
body: req.body
});
}
export default async (req: Request, requestContext: any) => {
//console.log("here");
if (!app) {
app = await getApp();
}
//const app = await getApp();
const request = getCleanRequest(req);
//console.log("url", req.url);
//console.log("req", req);
return app.fetch(request, process.env);
};
//export default handle(app.server.getInstance())
*/
});

BIN
examples/nextjs/test.db Normal file

Binary file not shown.