0.0.3 • Published 9 years ago

bluejs v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

bluejs

tiny tiny unstable, untested web framework

var app = require("bluejs")

// serve static files from the public directory
app.static("/public", path.join(__dirname, "public"));


//register route for a get request
app.route("/get")
.get()
.handler(function() {
  this.res.end("poo");
});

// register route for a post request
// and parse the body into a javascript object
app.route("/post")
.post()
.handler(function() {
  var self = this
  this.parseBody(function(err, body) {
    if (err) {
      console.error(err.message);
      return;
    }
    console.log("body", body);
    self.res.end('cool');
  });
});

app.server.listen(8080);