Code Monkey home page Code Monkey logo

vex's Introduction

Logo

Easy-to-use, modular web framework for V.

CI

Example written on VEX

module main

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

fn print_req_info(mut req ctx.Req, mut res ctx.Resp) {
	println('${req.method} ${req.path}')
}

fn do_stuff(mut req ctx.Req, mut res ctx.Resp) {
	println('incoming request!')
}

fn main() {
    mut app := router.new()
    app.use(do_stuff, print_req_info)

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

    app.route(.get, '/public/*path', fn (req &ctx.Req, mut res ctx.Resp) {
        res.send_file('public/' + req.params['path'], 200)
    })

    app.route(.get, '/path/:name', fn (req &ctx.Req, mut res ctx.Resp) {
        println('path is ${req.params["name"]}')
    }, fn (req &ctx.Req, mut res ctx.Resp) {
        res.send('path: ' + req.params['name'], 200)
    })

    app.route(.get, '/complex/:name/*path', fn (req &ctx.Req, mut res ctx.Resp) {
        res.send('username: ' + req.params['name'] + '\npath: ' + req.params['path'], 200)
    })

    server.serve(app, 6789)
}

Installation & Getting Started

Learn how to setup and use VEX by reading the Wiki.

Roadmap

  • Support for GET, POST, PUT, PATCH, DELETE, and OPTION HTTP methods.
  • HTTP Router (Wildcards are now supported)
  • Route groups (non-reusable for now)
  • Static file server
  • Params and query parsing
  • Middleware support
  • Cookie parsing (basic support)
  • Cookie manipulation / Session support
  • Websocket Server
  • Body parsing
    • application/x-www-form-urlencoded support
    • application/json 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

vex's People

Contributors

nedpals avatar spytheman avatar alichraghi avatar azhai avatar islonely avatar terisback avatar danieldaeschle avatar itsdonnix avatar chaosunity avatar ntbbloodbath avatar vincenzopalazzo avatar spaceface777 avatar whoizit avatar yuyi98 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.