File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // always import from jsr:@snaapi /snaapi to ensure the correct version is used, even if the package is installed locally
2- import { Snaapi } from "jsr:@snaapi/snaapi@0.11.0" ;
3-
4- const apiPort = Number ( Deno . env . get ( "API_PORT" ) ?? "8000" ) ;
51const sitePort = Number ( Deno . env . get ( "SITE_PORT" ) ?? "8080" ) ;
2+ const apiBase = Deno . env . get ( "API_BASE" ) ;
63
7- // Start the Snaapi API
8- const app = await Snaapi . app ( ) ;
9- await app . listen ( { port : apiPort } ) ;
10- console . log ( `Snaapi API running on http://localhost: ${ apiPort } ` ) ;
4+ if ( ! apiBase ) {
5+ console . error ( "API_BASE environment variable is required" ) ;
6+ Deno . exit ( 1 ) ;
7+ }
118
12- // Serve the demo site with the API base URL injected
13- const apiBase = Deno . env . get ( "API_BASE" ) ?? `http://localhost:${ apiPort } ` ;
149const escapedApiBase = JSON . stringify ( apiBase ) . slice ( 1 , - 1 ) ;
1510
1611const html = (
You can’t perform that action at this time.
0 commit comments