This commit is contained in:
root 2024-10-07 03:51:32 +02:00
parent ae69f03887
commit 4bbf9ce509
9 changed files with 15 additions and 14 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
start start
start_notcc

View File

@ -6,4 +6,4 @@ import web
mut app := web.new() mut app := web.new()
app.run() app.run()!

View File

@ -6,4 +6,4 @@ import web
mut app := web.new() mut app := web.new()
app.run() app.run()!

View File

@ -1,11 +1,11 @@
module web module web
import freeflowuniverse.crystallib.osal //import freeflowuniverse.crystallib.osal
import veb import veb
import rand
import os import os
import json // import json
import time // import time
// import rand
pub struct Context { pub struct Context {
veb.Context veb.Context
@ -34,6 +34,6 @@ pub struct RunParams {
port int = 8080 port int = 8080
} }
pub fn (mut app App) run(params RunParams) { pub fn (mut app App) run(params RunParams)! {
veb.run[App, Context](mut app, params.port) veb.run_at[App, Context](mut app, veb.RunParams{ host: '0.0.0.0' port: params.port family: .ip })!
} }

View File

@ -1,12 +1,12 @@
module web module web
import freeflowuniverse.crystallib.osal //import freeflowuniverse.crystallib.osal
import veb import veb
import rand // import rand
import os // import os
import json // import json
import freeflowuniverse.crystallib.webserver.auth.jwt // import freeflowuniverse.crystallib.webserver.auth.jwt
import time // import time
pub fn (app &App) index(mut ctx Context) veb.Result { pub fn (app &App) index(mut ctx Context) veb.Result {
return ctx.html($tmpl('./templates/index.html')) return ctx.html($tmpl('./templates/index.html'))