Skip to content

Instantly share code, notes, and snippets.

@lexfrl
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save lexfrl/f6ba33b26024309a288d to your computer and use it in GitHub Desktop.

Select an option

Save lexfrl/f6ba33b26024309a288d to your computer and use it in GitHub Desktop.
import r from "superagent-bluebird-promise";
import router from "./router";
export default {
"request": (req, context) => {
let route = router.match(req.url);
return context.set("route", route);
},
"route": (route, context) => {
let {name, params: { id }} = route;
let url = router.url({name, params: {id}});
return context.set(url.substr(1).replace("/", "."), r.get("http://ggifster.ru/api/" + url).then(res => res.body))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment