Last active
August 29, 2015 14:22
-
-
Save lexfrl/f6ba33b26024309a288d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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