Skip to content

dhonx/vex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Web framework written on V inspired by Express and Sinatra

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • V 100.0%