Trax is a web framework for Haxe similar to Express.
This project is still work in progress. Expect missing features and bugs. (Pull requests are always welcome!)
- Implement middleware
- Implement parsing of GET parameters and POST bodies (partially)
- More features
package;
import trax.Middleware;
import trax.Router;
class Main {
static function main() {
final address = "127.0.0.1";
final port = 3000;
final app = new Router(address, ()->{
trace('Server is listening on http://$address:$port/');
});
app.get("/", (req, res)->{
res.send("Hello World!\n");
res.send("Your Useragent: " + req.headers.get("User-Agent") + "\n");
if(req.body.foo == "bar")
res.send("foobar!");
});
app.listen(port);
}
}