forked from complex-joins/alexa-app-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request alexa-js#8 from alexcstark/master
git ignored and mystery file
- Loading branch information
Showing
16 changed files
with
168 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
### node etc ### | ||
|
||
secret | ||
|
||
|
||
work-stash | ||
|
||
# Logs | ||
|
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// secret/config.js | ||
|
||
// Create a copy of this file called config.js and put your API keys there | ||
module.exports = { | ||
DB_CONFIG_OBJ: { | ||
host: 'ec2-54-225-89-110.compute-1.amazonaws.com', | ||
password: 'oRSQ_ftv16N6j73loVMTdwgbZW', | ||
database: 'd2f7venevnjv5t', | ||
port: 5432, | ||
user: 'ecogqyqjcbbetg', | ||
ssl: true | ||
}, | ||
UBER_SERVER_TOKEN: 'pG-f76yk_TFCTMHtYHhY7xUfLVwmt9u-l4gmgiHE', | ||
GOOGLE_PLACES_API_KEY: 'AIzaSyDlX18NHXJ27_aZaXfpuABKe4B_ysOcoPA', | ||
LYFT_BEARER_TOKEN: 'gAAAAABXqkmC1umTQbXVia0xRwloEZkq1ljy5eT1Mk2VfTuE6iMqkWeRDiTBXEmhlNuFUTpwJLu6zbEeRoACqnfp_uFZnpGAEROwnIm3nvV8QLAJD0jrGBGk8ErUgyMlytHXpJ0-cup_3aSv1TH3or368C34grkfSIkN3xbnrH7u6MsQMvHUXN8VJi8xbUNaMLK1Y9HMA51NXApOxhGUan2ZDTqop9UM2A==', | ||
LYFT_USER_ID: 'gC8NlVZa847Y:PB3nRSO6pvd6SqV_85yr_hC-wgIDL0e-', | ||
twilioCredentials: { | ||
accountSid: 'ACbec44eaea12e629b07ccc6f5a8371836', | ||
authToken: 'a3adbdb1e299c34ef0ac11e8cc859bfd' | ||
}, | ||
CARVIS_API: '54.183.205.82', | ||
CARVIS_API_KEY: 'o2h3nrkjSDfQ@#rjlks2$TASjdfs', | ||
USER_ENCRYPT: '239823jf' | ||
}; | ||
|
||
/* | ||
LYFT_BEARER_TOKEN currently hardcoded, needs to be updated every 86400 seconds. | ||
TODO: update dynamically: | ||
-- for updating one has to use the `refreshBearerToken` function from './../src/server/utils/lyft-helper.js'. | ||
*/ |
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const DB_CONFIG_OBJ = require('../../secret/config').DB_CONFIG_OBJ; | ||
import Stork from 'storkSQL'; | ||
const DB_CONFIG_OBJ = process.env.DB_CONFIG_JSON ? JSON.parse(DB_CONFIG_JSON) : require('../../secret/config').DB_CONFIG_OBJ; | ||
|
||
const dbConnection = new Stork(DB_CONFIG_OBJ, 'pg'); | ||
export default dbConnection; |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,73 @@ | ||
describe('test carvis api', () => { | ||
const assert = require('chai').assert; | ||
const axios = require('axios'); | ||
const server = require('./testServer'); | ||
let currentListeningServer; | ||
|
||
describe('API server', function () { | ||
before(function () { | ||
currentListeningServer = server.default.listen(3030); | ||
}); | ||
|
||
after(function () { | ||
currentListeningServer.close(); | ||
}); | ||
|
||
describe('Check basic build', function () { | ||
it('should return 200', function (done) { | ||
axios.get('http://localhost:3030/') | ||
.then((res) => { | ||
assert.equal(res.status, 200, 'did not return 200', res.status); | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('Check restful routes', function () { | ||
|
||
it('should get all users when presented with the API access token', function (done) { | ||
axios.get('http://localhost:3030/dev/users', { | ||
headers: {'x-access-token': process.env.CARVIS_API_KEY || require('../secret/config').CARVIS_API_KEY} | ||
}) | ||
.then((res) => { | ||
assert.equal(res.status, 200, 'did not return 200', res.status); | ||
done(); | ||
}); | ||
}); | ||
|
||
let testUserId; | ||
|
||
it('should allow a developer to add a user when presented with the right access token', function (done) { | ||
axios.post('http://localhost:3030/dev/users', {email: '[email protected]', password: 'test'}, { | ||
headers: {'x-access-token': process.env.CARVIS_API_KEY || require('../secret/config').CARVIS_API_KEY} | ||
}) | ||
.then((res) => { | ||
testUserId = res.data[0].id; | ||
assert.equal(res.status, 200, 'did not return 200', res.status); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should users to update their information', function (done) { | ||
axios.put(`http://localhost:3030/users/update/${testUserId}`, {email: '[email protected]', password: 'newtest'}, { | ||
}) | ||
.then((res) => { | ||
assert.equal(res.status, 200, 'did not return 200', res.status); | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it('should delete the user created by the developer', function (done) { | ||
axios.delete(`http://localhost:3030/dev/users/${testUserId}`, { | ||
headers: {'x-access-token': process.env.CARVIS_API_KEY || require('../secret/config').CARVIS_API_KEY} | ||
}) | ||
.then((res) => { | ||
assert.equal(res.status, 200, 'did not return 200', res.status); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
|
||
|
||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import express from 'express'; | ||
import { PORT, configureServer } from '../src/server/server-configuration/config'; | ||
import routes from '../src/server/routes'; | ||
|
||
const app = express(); | ||
// Sessions, passport, auth middleware | ||
configureServer(app); | ||
// Set up routes | ||
routes(app); | ||
|
||
export default app; |
This file contains 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 characters