Created
October 23, 2015 21:17
-
-
Save nealrs/06daf79c08c098e9c3af to your computer and use it in GitHub Desktop.
Devpost -> image
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
var request = require('request'); | |
var handlebars = require('handlebars'); | |
var project = 'distractedness'; | |
var url = 'http://devpost.com/software/' + project; | |
var api = 'https://iii3mdppm7.execute-api.us-east-1.amazonaws.com/prod/ProjectEndpoint/' + project; | |
var source = "<h2>{{title}}</h2><p>{{tagline}}</p><ul>{{#collaborators}}<li> <img src='{{avatar_url}}'> {{name}}</li>{{/collaborators}}</ul><ul>{{#built_with}}<li> #{{name}}</li>{{/built_with}}</ul>"; | |
request({url: api, json: true}, function(err, res, json) { | |
if (err) {throw err;} | |
//var data = json; | |
//console.log(data.title, data.tagline, data.collaborators, data.built_with); | |
var template = handlebars.compile(source); | |
var html = template(json); | |
console.log(html); | |
}); |
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
{ | |
"name": "getData", | |
"version": "1.0.0", | |
"description": "get project data", | |
"main": "index.js", | |
"author": "Neal Shyam", | |
"license": "ISC", | |
"dependencies": { | |
"handlebars": "^4.0.3", | |
"request": "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment