Last active
          June 30, 2017 15:07 
        
      - 
      
- 
        Save zhgqthomas/d500c32f78859eddfa7f624f255368ba to your computer and use it in GitHub Desktop. 
Revisions
- 
        zhgqthomas revised this gist Jun 30, 2017 . No changes.There are no files selected for viewing
- 
        zhgqthomas revised this gist Jun 30, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,10 @@ AV.Cloud.define('stencils', function (request, response) { hostname: 'www.autodraw.com', path: '/assets/stencils.json', port: 443, method: 'GET', headers: { accept: '*/*' } }; const req = https.request(options, function (res) { @@ -26,7 +29,6 @@ AV.Cloud.define('stencils', function (request, response) { res.on('end', function () { const payload = JSON.parse(output); response.success(payload); }); } 
- 
        zhgqthomas created this gist Jun 30, 2017 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,81 @@ const https = require('https'); AV.Cloud.define('stencils', function (request, response) { const options = { hostname: 'www.autodraw.com', path: '/assets/stencils.json', port: 443, method: 'GET' }; const req = https.request(options, function (res) { if (res.statusCode < 200 || res.statusCode > 299) { res.on('error', function (error) { response.error(new Error(error.message)); }); } else { var output = ''; res.setEncoding('utf8'); res.on('data', function (chunk) { output += chunk; }); res.on('end', function () { const payload = JSON.parse(output); console.log(payload); response.success(payload); }); } }); req.on('error', function (error) { response.error(new Error(error.message)) }); req.end() }); AV.Cloud.define('matchDraw', function (request, response) { const options = { hostname: 'inputtools.google.com', path: '/request?ime=handwriting&app=autodraw&dbg=1&cs=1&oe=UTF-8', method: 'POST', headers: { 'Content-Type': 'application/json' } }; const req = https.request(options, function (res) { if (res.statusCode < 200 || res.statusCode > 299) { res.on('error', function (error) { response.error(new Error(error.message)); }); } else { var payload = ''; res.setEncoding('utf8'); res.on('data', function (chunk) { payload += chunk; }); res.on('end', function () { response.success(payload); }); } }); req.write(JSON.stringify(request.params)); req.on('error', function (error) { response.error(new Error(error.message)) }); req.end() });