I am a new aspiring software developer (currently network engineer/sysadmin) treating Vlang as my first and hopefully main language of choice. I am trying to build an API gateway for pocketbase. This is my current code, i want the user to visit /login and then be forwarded to the pocketbase admin instance
module main
import nedpals.vex.server
import nedpals.vex.ctx
import nedpals.vex.router
import net.http
fn main() {
mut app := router.new()
app.route(.get, '/', fn (req &ctx.Req, mut res ctx.Resp) {
http.get('http://localhost:8090/_/#/login') or {}
})
app.route(.get, '/users/:name', fn (req &ctx.Req, mut res ctx.Resp) {
println('path is ${req.params["name"]}')
}, fn (req &ctx.Req, mut res ctx.Resp) {
http.get('path: ' + req.params['name']) or {resp.body}
})
The above code is not working
I tried looking online for some simple examples but i could not find any. Can someone more experienced assist here?
Thanks
Aimable