vweb: update references to old .init_once() and .init() methods to .init_server() and .before_request()
parent
5e0ff5c524
commit
cafe382424
|
@ -91,7 +91,7 @@ mut:
|
|||
struct WebhookServer {
|
||||
vweb.Context
|
||||
mut:
|
||||
gen_vc &GenVC = 0 // initialized in init_once
|
||||
gen_vc &GenVC = 0 // initialized in init_server
|
||||
}
|
||||
|
||||
// storage for flag options
|
||||
|
@ -156,12 +156,6 @@ pub fn (mut ws WebhookServer) init_server() {
|
|||
// ws.gen_vc = new_gen_vc(flag_options)
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn (mut ws WebhookServer) init() {
|
||||
// ws.init_once()
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn (mut ws WebhookServer) index() {
|
||||
eprintln('WebhookServer.index() called')
|
||||
}
|
||||
|
@ -198,7 +192,6 @@ fn parse_flags(mut fp flag.FlagParser) FlagOptions {
|
|||
}
|
||||
}
|
||||
|
||||
// init
|
||||
fn (mut gen_vc GenVC) init() {
|
||||
// purge repos if flag is passed
|
||||
if gen_vc.options.purge {
|
||||
|
|
|
@ -16,7 +16,7 @@ fn main() {
|
|||
vweb.run<App>(port)
|
||||
}
|
||||
|
||||
pub fn (mut app App) init_once() {
|
||||
pub fn (mut app App) init_server() {
|
||||
// Arbitary mime type.
|
||||
app.serve_static('/favicon.ico', 'favicon.ico', 'img/x-icon')
|
||||
// Automatically make available known static mime types found in given directory.
|
||||
|
@ -26,9 +26,6 @@ pub fn (mut app App) init_once() {
|
|||
app.handle_static('.', false)
|
||||
}
|
||||
|
||||
pub fn (mut app App) init() {
|
||||
}
|
||||
|
||||
pub fn (mut app App) index() vweb.Result {
|
||||
// We can dynamically specify which assets are to be used in template.
|
||||
// mut am := assets.new_manager()
|
||||
|
|
|
@ -18,7 +18,7 @@ fn main() {
|
|||
vweb.run<App>(port)
|
||||
}
|
||||
|
||||
pub fn (mut app App) init_once() {
|
||||
pub fn (mut app App) init_server() {
|
||||
app.handle_static('.', false)
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ pub fn (mut app App) cow() vweb.Result {
|
|||
}
|
||||
|
||||
/*
|
||||
pub fn (app App) init_once() {
|
||||
pub fn (app App) init_server() {
|
||||
//
|
||||
}
|
||||
|
||||
pub fn (app App) init() {
|
||||
pub fn (app App) before_request() {
|
||||
//
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -37,10 +37,7 @@ fn main() {
|
|||
vweb.run_app<App>(mut app, http_port)
|
||||
}
|
||||
|
||||
pub fn (mut app App) init() {
|
||||
}
|
||||
|
||||
pub fn (mut app App) init_once() {
|
||||
pub fn (mut app App) init_server() {
|
||||
eprintln('>> webserver: started on http://127.0.0.1:$app.port/ , with maximum runtime of $app.timeout milliseconds.')
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue