vweb example not working

Created on 5 Aug 2019  路  7Comments  路  Source: vlang/v

compiling this vweb example:

module main

import vweb

const (
    Port = 8082
)

struct App {
pub mut:
        vweb vweb.Context // TODO embed
}

fn main() {
        println('Running vweb test on http://localhost:$Port')
        vweb.run<App>(Port)
}

pub fn (app mut App) init() {
    app.vweb.handle_static('.')
}

pub fn (app mut App) json_endpoint() {
        app.vweb.json('{"a": 3}')
}

pub fn (app mut App) index() {
        app.vweb.text('hello world')
}

result in this error:
panic: vweb.v:83
undefined: T

Bug

Most helpful comment

cd v/examples/vweb
v test_app.v
./test_app
Running vweb test on http://localhost:8082

Works for me.

All 7 comments

cd v/examples/vweb
v test_app.v
./test_app
Running vweb test on http://localhost:8082

Works for me.

Make sure your V is up-to-date: v up.

sorry for reopening --
okay so i think i havent updated my v yet
but after updating it now the error changed into this

.test_app.c:101:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.V panic: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose

@pramonow Have you tried using the search: https://github.com/vlang/v/issues/1432#issuecomment-517649506 ?

libcurl dependency was removed.

@pramonow have you tried v up?

You really shouldn't be getting that error message.

@hakimio have not

@medvednikov i believed i have, i will try to clone it back and try building again later

okay after cloning it again, now it works thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

penguindark picture penguindark  路  3Comments

radare picture radare  路  3Comments

oleg-kachan picture oleg-kachan  路  3Comments

medvednikov picture medvednikov  路  3Comments

taojy123 picture taojy123  路  3Comments