Guest User

Untitled

a guest
Nov 29th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. var express = require('express');
  2. var app = express();
  3. var http = require('http').Server(app);
  4. var cfenv = require("cfenv");
  5.  
  6. var appEnv = cfenv.getAppEnv();
  7.  
  8. var myJson;
  9.  
  10. // respond with JSON when a GET request is made to the index
  11. app.get('/', function (req, res) {
  12. res.send(myJson)
  13. })
  14.  
  15. app.listen(3000);
  16.  
  17. var PersonalityInsightsV2 = require('watson-developer-cloud/personality-insights/v2');
  18.  
  19. var personality_insights = new PersonalityInsightsV2({
  20. username: '',
  21. password: ''
  22. });
  23.  
  24. personality_insights.profile({
  25. text: "Orestes; so he said to the other gods: See now, how men lay blame upon us gods for what is after all noth- ing but their own folly. Look at Aegisthus; he must needs make love to Agamemnons wife unrighteously and then kill Agamemnon, though he knew it would be the death of him; for I sent Mercury to warn him not to do either of these things, inasmuch as Orestes would be sure to take his revenge when he grew up and wanted to return home. Mercury told him this in all good will but he would not lis- ten, and now he has paid for everything in full.Then Minerva said",
  26. language: 'en' },
  27. function (err, response) {
  28. if (err)
  29. console.log('error:', err);
  30. else
  31. myJson = JSON.stringify(response, null, 2);
  32. });
  33.  
  34. "id": "Intellect", "name": "Intellect", "category": "personality", "percentage": 0.9295559487163333, "
Add Comment
Please, Sign In to add comment