mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
updated examples
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
BIN
examples/nextjs/test.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user