Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
germanattanasio committed Jun 2, 2017
1 parent 76a0655 commit e6719bd
Show file tree
Hide file tree
Showing 43 changed files with 5,189 additions and 1,057 deletions.
37 changes: 0 additions & 37 deletions .bluemix/pipeline.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

17 changes: 0 additions & 17 deletions CONTRIBUTING.md

This file was deleted.

18 changes: 0 additions & 18 deletions GulpFile.js
@@ -1,22 +1,4 @@
/**
* Copyright 2016 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

require('./dot-env');
var gulp = require('gulp');
var wrench = require('wrench');

Expand Down
297 changes: 85 additions & 212 deletions README.md

Large diffs are not rendered by default.

51 changes: 26 additions & 25 deletions app.js
@@ -1,41 +1,27 @@
/**
* Copyright 2016 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var app = require('express')();
var express = require('express');
var bodyParser = require('body-parser');
var path = require('path');

'use strict';
// Configure Express
app.set('view engine', 'ejs');
require('ejs').delimiter = '$';
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '../public')));

var app = require('express')();
var profileByUser = {};

var watson = require('watson-developer-cloud');
var personalityInsights = watson.personality_insights({ version: 'v2' });
var processProfile = require('./util/process-personality-profile');

// Bootstrap application settings
require('./config/express')(app);

// render index page
app.get('/', function(req, res) {
res.render('tweets');
});

/**
* Returns the personality Insights from a username
* @param {String} '/api/profile' The path
* @param {function} The route callback
* @return {undefined}
* Returns the personality Insights from a username.
*/
app.get('/api/profile', function(req, res, next) {
if (!req.query.username) {
Expand Down Expand Up @@ -65,6 +51,21 @@ app.get('/tweets', function(req, res) {
res.render('tweets');
});

require('./config/error-handler')(app);
// catch 404 and forward to error handler
app.use((req, res, next) => {
const err = new Error('Not Found');
err.code = 404;
err.message = 'Not Found';
next(err);
});

// error handler
app.use((err, req, res, next) => {
const error = {
code: err.code || 500,
error: err.error || err.message,
};
res.status(error.code).json(error);
});

module.exports = app;
File renamed without changes.
36 changes: 0 additions & 36 deletions config/error-handler.js

This file was deleted.

45 changes: 0 additions & 45 deletions config/express.js

This file was deleted.

57 changes: 0 additions & 57 deletions config/security.js

This file was deleted.

38 changes: 38 additions & 0 deletions credentials.json
@@ -0,0 +1,38 @@
{
"natural_language_classifier": [
{
"credentials": {
"url": "https://gateway.watsonplatform.net/natural-language-classifier/api",
"username": "YOUR natural_language_classifier USERNAME",
"password": "YOUR natural_language_classifier PASSWORD"
}
}
],
"tone_analyzer": [
{
"credentials": {
"url": "https://gateway.watsonplatform.net/tone-analyzer/api",
"username": "YOUR tone_analyzer USERNAME",
"password": "YOUR tone_analyzer PASSWORD"
}
}
],
"personality_insights": [
{
"credentials": {
"url": "https://gateway.watsonplatform.net/personality-insights/api",
"username": "YOUR personality_insights USERNAME",
"password": "YOUR personality_insights PASSWORD"
}
}
],
"natural-language-understanding": [
{
"credentials": {
"url": "https://gateway.watsonplatform.net/natural-language-understanding/api",
"username": "YOUR natural-language-understanding USERNAME",
"password": "YOUR natural-language-understanding PASSWORD"
}
}
]
}

0 comments on commit e6719bd

Please sign in to comment.