Skip to content
Web framework written on V inspired by Express and Sinatra
V
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Remove unused json import. Nov 18, 2019
server
.gitignore update examples/ Nov 17, 2019
LICENSE add license Nov 17, 2019
README.md typo? Nov 18, 2019

README.md

Vex

Web framework written on V inspired by Express and Sinatra.

Vex is still in its early stages and some of the parts were not implemented yet.

module main

import vex.server as vex
import json
import os

struct Person {
    name string
    doing string
}

fn show_root(req vex.Request, res mut vex.Response) {
    res.send_file('index.html', 200)  
}

fn print_json(req vex.Request, res mut vex.Response) {
    res.send_json(json.encode(Person{ name: req.params['name'], doing: req.params['doing'] }), 200)
}

fn log_server(req vex.Request, res vex.Response) {
    println('${req.path}')
}

fn main() {
    mut s := vex.new()
    s.serve_static('public')
    s.get('/', show_root)
    s.get('/hey/:name/:doing', print_json)
    s.connect(log_server, ['*', '!/hey']) // middleware

    s.serve(6789)
}

vex and vweb

Vex is committed to bring some of its features and optimizations to the vweb framework once it is stable.

Dependencies

Vex uses v-mime to identify MIME types when serving files.

Roadmap

  • Support for GET, POST, PUT, PATCH, DELETE, and OPTION HTTP methods.
  • HTTP Router (wildcards not yet supported)
  • Static file server
  • Params and query parsing
  • Body parsing (supports raw text for now)
  • Middleware support
  • Cookie parsing (basic support)
  • Form data parsing
    • application/x-www-form-urlencoded support
    • multipart/form-data support

Contributing

  1. Fork it (https://github.com/nedpals/vex/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Examples

Examples can be found at the /examples directory.

License

MIT

Contributors

You can’t perform that action at this time.