39 lines
600 B
Coq
39 lines
600 B
Coq
|
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) }
|
||
|
|
||
|
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)
|
||
|
}
|