Skip to content
Browse files

starting an endpoint for conversion

  • Loading branch information...
1 parent 2c42982 commit 4c972599dfed55779d4887a525ca50fd8739abc3 @aaronpowell committed Jan 4, 2012
Showing with 19 additions and 5 deletions.
  1. +2 −1 package.json
  2. +5 −1 static/app.js
  3. +2 −1 views/layout.jade
  4. +10 −2 web.js
View
3 package.json
@@ -3,6 +3,7 @@
"version": "1.0.0",
"dependencies": {
"express": ">=2.5.0",
- "jade": ">=0.18.0"
+ "jade": ">=0.18.0",
+ "html2jade": ">=0.1.0"
}
}
View
6 static/app.js
@@ -1,3 +1,7 @@
(function (exports) {
-
+ exports.convert = function (html, cb) {
+ $.post('/convert', { html: html }, function (jade) {
+ console.log(arguments);
+ });
+ };
}).call(window, window.app = {});
View
3 views/layout.jade
@@ -10,4 +10,5 @@ html.no-js(lang='en')
body
!= body
- script(src="https://raw.github.com/donpark/html2jade/master/lib/html2jade.js")
+ script(src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")
+ script(src="/app.js")
View
12 web.js
@@ -1,15 +1,23 @@
var express = require('express'),
server = express.createServer(),
pub = __dirname + '/static/',
- views = __dirname + '/views';
+ views = __dirname + '/views'/*,
+ html2jade = require('html2jade')*/;
server.use(server.router);
+server.use(express.bodyParser());
server.use(express.static(pub));
server.set('view engine', 'jade');
server.set('views', views);
+server.post('/convert', function (req, res) {
+ console.log(res);
+
+ req.json('jade here');
+});
+
server.get('/', function (req, res) {
res.render('index');
});
-server.listen(process.env.PORT || 8888);
+server.listen(process.env.PORT || 9999);

0 comments on commit 4c97259

Please sign in to comment.
Something went wrong with that request. Please try again.