Repository

Spaceship

Installation

v up
v install cookieforpres.spaceship

Example

module main

import cookieforpres.spaceship

fn handler(mut req spaceship.Request, mut res spaceship.Response) {
    res.set_body('Welcome to Spaceship 🚀. Get ready for blast off!')
}

fn main() {
    mut sp := spaceship.new('0.0.0.0', 8080)

    mut route := spaceship.new_route('/', ['GET', 'POST'], handler)
    sp.add_route(route)

    sp.listen() or { panic(err) }
}

Upcoming Features / Already Implemented

  • sending files (e.g. images, html file, json file, etc.)
  • having a static folder for css and js files
  • middleware

if you have any suggestions or want to contribute, please feel free to open an issue or make a pull request on GitHub

About

0
32
1 year ago

Author

cookieforpres