mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
updated examples
This commit is contained in:
@@ -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())
|
||||
*/
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user