Browse Source

Updating package.json to reflect github location; improving database.js; and minor tweaks to app.js method variable

master
Levi Olson 8 years ago
parent
commit
636c439eff
3 changed files with 12 additions and 9 deletions
  1. +6
    -3
      app.js
  2. +1
    -1
      database.js
  3. +5
    -5
      package.json

+ 6
- 3
app.js View File

@ -34,9 +34,11 @@ app.all('*', function(req, res, next) {
console.log(req.body._method);
console.log(url);
console.log(req.path);
var method = req.body._method || req.method;
request(
{
method : req.body._method || req.method,
method : method,
uri : url + req.path,
multipart : [{
'content-type' : 'application/json',
@ -46,10 +48,11 @@ app.all('*', function(req, res, next) {
function(error, response, body) {
if (!error && response.statusCode == 200) {
var request = {
"ok" : response.statusCode==200?true:false,
"baseUrl" : url,
"body" : req.body,
"method" : req.method,
"requestParams" : req.body.params,
"method" : method,
"ProxyRequest" : req.body.params,
"originalUrl" : req.originalUrl,
"path" : req.path,
"protocol" : req.protocol,

+ 1
- 1
database.js View File

@ -12,7 +12,7 @@ module.exports.DatabaseLookup = function(req, done) {
connection.connect(function(err) {
if (err) done(err);
});
connection.query('SELECT password FROM users WHERE email = \''+req.body.email+'\'', function(err, result, fields) {
connection.query(mysql.format('SELECT password FROM users WHERE email = ?', [req.body.email]), function(err, result, fields) {
if (err) done(err);
if (!result || !result[0] || !result[0].password) return done(null, false);

+ 5
- 5
package.json View File

@ -1,18 +1,18 @@
{
"name": "Guardian",
"version": "0.0.1",
"description": "Proof-of-concept for the guardian service.",
"description": "A single proxy server to authenticate requests to multiple internal APIs",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/leothelocust/guardian-node.git"
"url": "git@github.com:leothelocust/guardian-api-proxy.git"
},
"author": "Levi Olson <olson.levi@gmail.com>",
"license": "UNLICENSED",
"homepage": "https://bitbucket.org/leothelocust/guardian-node#readme",
"author": "Levi Olson <leothelocust> on GitHub",
"license": "MIT License",
"homepage": "https://github.com/leothelocust/guardian-api-proxy",
"dependencies": {
"bcrypt": "^0.8.5",
"body-parser": "^1.14.2",

Loading…
Cancel
Save