Skip to content

Commit

Permalink
v | added vex
Browse files Browse the repository at this point in the history
  • Loading branch information
koplenov committed Aug 5, 2023
1 parent bc73fdf commit cbb8df4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions v/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ WORKDIR /app
COPY '{{source}}' '{{target}}'
{{/files}}

{{#bootstrap}}
RUN {{{.}}}
{{/bootstrap}}

RUN v . -prod -o server

FROM alpine
Expand Down
6 changes: 6 additions & 0 deletions v/vex/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework:
github: nedpals/vex
version: 0.3.5

bootstrap:
- v install nedpals.vex
27 changes: 27 additions & 0 deletions v/vex/main.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module main

import nedpals.vex.router
import nedpals.vex.server
import nedpals.vex.ctx

fn main() {
mut app := router.new()

app.route(.get, '/', fn (req &ctx.Req, mut res ctx.Resp) {
res.send('', 200)
})

app.route(.get, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
res.send('', 200)
})

app.route(.get, '/user/:id', fn (req &ctx.Req, mut res ctx.Resp) {
res.send(req.params['id'], 200)
})

app.route(.post, '/user', fn (req &ctx.Req, mut res ctx.Resp) {
res.send('', 200)
})

server.serve(app, 3000)
}

0 comments on commit cbb8df4

Please sign in to comment.