www_veda2/web/factory.v

40 lines
684 B
Coq
Raw Normal View History

2024-10-07 01:21:48 +00:00
module web
import freeflowuniverse.crystallib.osal
import veb
import rand
import os
import json
import time
pub struct Context {
veb.Context
}
pub struct App {
veb.StaticHandler
pub:
adminkey string
}
// Main entry point
pub fn new() &App {
mut app := &App{}
// Start the Veb web server on port 8080
app.static_mime_types['.map'] = 'txt/plain'
app.mount_static_folder_at('${os.dir(@FILE)}/static', '/static') or { panic(err) }
2024-10-07 01:37:16 +00:00
app.mount_static_folder_at('${os.dir(@FILE)}/static', '/assets') or { panic(err) }
2024-10-07 01:21:48 +00:00
return app
}
@[params]
pub struct RunParams {
port int = 8080
}
pub fn (mut app App) run(params RunParams) {
veb.run[App, Context](mut app, params.port)
}