Skip to content
forked from micmro/Stylify-Me

Website style analizer for designers. This is the service part that does the analization etc.

License

Notifications You must be signed in to change notification settings

SSSV/Stylify-Me

 
 

Repository files navigation

Stylify Me

A Style Guide Generator - using NodeJS and PhantomJS, a command line webkit browser. See it live at http://stylifyme.com

This repo only contains the web service. We host our app on Heroku using the multi buildpack.

Running the service locally

  1. Make sure you have NodeJS installed and running

  2. Install dependencies with npm npm install

  3. Download PhantomJS and copy it to REPOFOLDER/vendor/phantomjs/bin/phantomjs or update the path in app.js

    var config = {
    	binPath : "vendor/phantomjs/bin/phantomjs"
    	....
    };
  4. Update the referer url check in "app.js" with the url of your frontend (local and production):

    isRefererValid : function(referer){
    		var validRefs = ["http://stylifyme.com", "http://www.stylifyme.com", "http://stylify.herokuapp.com", "http://localhost:9185", "http://localhost:" + app.get('port')]
    			,isvalid = false;
    		.....
    	}
  5. Start the nodeJs app with node app.js

  6. Query http://localhost:5000/query?url=http%3A%2F%2Fgoogle.com (assuming you run your app on port 5000) and you should be able to see a JSON response I recomend using Postman for debugging your api

Frontend

This repo only contains the web service, you can query it from the front end like this:

var urlToQuery = encodeURIComponent("http://google.com");

$.ajax({
	dataType: "jsonp",
	url: "http://youreServiceUrl.com/query?url="+ urlToQuery,
	success: function(data){
		if(data["error"]){
			alert("Error: " + data["error"]);
			return;
		}
		//PROCESS the result		
	},
	timeout : 10000
}).fail(function(){
	alert("Could not query site, the service might be down, please try again later.");
});

About

Website style analizer for designers. This is the service part that does the analization etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 65.5%
  • HTML 34.5%