File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "imports" : {
3- "hono " : " npm:hono " ,
4- "mongodb " : " npm:mongodb "
3+ "@db/mongo " : " jsr:@db/mongo@^0.34.0 " ,
4+ "@hono/hono " : " jsr:@hono/hono@^4.11.1 "
55 },
66 "fmt" : {
77 "indentWidth" : 4 ,
Original file line number Diff line number Diff line change 1- import { Hono } from "hono" ;
2- import { bearerAuth } from "hono/bearer-auth" ;
3- import { logger } from "hono/logger" ;
4- import { MongoClient } from "mongodb " ;
1+ import { Hono } from "@hono/ hono" ;
2+ import { bearerAuth } from "@hono/ hono/bearer-auth" ;
3+ import { logger } from "@hono/ hono/logger" ;
4+ import { MongoClient } from "@db/mongo " ;
55
66const app = new Hono ( ) ;
77
@@ -12,16 +12,18 @@ interface TokenDoc {
1212}
1313
1414// Connect to MongoDB
15- const client = new MongoClient ( Deno . env . get ( "MONGODB_URI" ) ! ) ;
16- client . connect ( ) ; // Make sure to connect before using
15+ const client = new MongoClient ( ) ;
16+ client . connect ( Deno . env . get ( "MONGODB_URI" ) ! ) ; // Make sure to connect before using
1717
18- const db = client . db ( "ollama" ) ;
18+ const db = client . database ( "ollama" ) ;
1919
2020function removeTrailingSlash ( str : string ) : string {
2121 // Check if the string ends with a slash and remove it if present
2222 return str . endsWith ( "/" ) ? str . slice ( 0 , - 1 ) : str ;
2323}
2424
25+ const ollama_url = removeTrailingSlash ( Deno . env . get ( "OLLAMA_URL" ) ! ) ;
26+
2527app . use ( logger ( ) ) ;
2628
2729app . use (
@@ -40,8 +42,6 @@ app.use(
4042 } ,
4143 } ) ,
4244 async ( c ) => {
43- const ollama_url = removeTrailingSlash ( Deno . env . get ( "OLLAMA_URL" ) ! ) ;
44-
4545 try {
4646 const response = await fetch ( `${ ollama_url } ${ c . req . path } ` , {
4747 method : c . req . method ,
You can’t perform that action at this time.
0 commit comments