I’m a bit stumped as to how I should define a Route in Haxe. All good in JavaScript, but the Haxe syntax for defining a route escapes me because I have no idea how to instantiate a route. I tried all sorts of weird syntax such as
var storyRouter: Router = Express.Router().get(x, (req, res, next) → {});
I’ve seen an example on GitHub:
but it doesn’t work for the externs I’ve generated with dts2hx.
Trying to do
router = new Router();
Results in the mother of all verbose errors (it’s 6 KB in length ).
Managed to get this to compile:
var storyRouter: express_serve_static_core.Router = Express.Router();
But have no idea how to use it. This, for example, fails with “no suitable overload”.
storyRouter.get("/story", (req, res, next) ->
{
res.end("Index");
});
I’m obviously not very good at understanding how to call externs yet.