aniftyco / kubit

Full stack web framework for Node.js
https://kubitjs.com/
MIT License
25 stars 2 forks source link

Extend BriskRoute#render macro to accept callback for data #58

Open joshmanders opened 3 months ago

joshmanders commented 3 months ago

Right now you can do Route.on('foo').render('bar', data); and it will work, but it would be nice to shorten

Route.get('foo', ({ view }) => {
  const data = await getData();

  return view.render('bar', data);
});

Into a BriskRoute method like this

Route.on('foo').render('bar', getData);