Skip to content

Instantly share code, notes, and snippets.

@nealrs
Created October 23, 2015 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nealrs/06daf79c08c098e9c3af to your computer and use it in GitHub Desktop.
Save nealrs/06daf79c08c098e9c3af to your computer and use it in GitHub Desktop.
Devpost -> image
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);
});
{
"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