Skip to content

Commit

Permalink
trying this again
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerie MacDougall authored and Valerie MacDougall committed Mar 6, 2018
0 parents commit c6252d8
Show file tree
Hide file tree
Showing 23 changed files with 14,923 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wine_backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
key.js

# dependencies
/node_modules
42 changes: 42 additions & 0 deletions wine_backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const express = require('express')
const app = express()
const axios = require('axios')
const key = require('../key.js');
const bodyParser = require('body-parser')
const cors=require('cors')
let lcboKey = key.key;
let trial = []

app.use(bodyParser.urlencoded({extended:false}))
app.use(bodyParser.json())
app.use(cors())

axios.get(`http://lcboapi.com/products?q=red+wine&store_id=511&where=is_vqa&access_key=${lcboKey}`).then((result) => {
//console.log('success' + JSON.stringify(result.data.result))
let winelist = []
let data = result.data.result;
for (i = 0; i < data.length; i++) {
if (data[i].primary_category === "Wine") {
winelist.push(data[i]);
}
}
// console.log(winelist);
}).catch((err) => {
console.log('got an error' + err)
})

app.post('/wine',(req,res)=>{
console.log(req.body)
})

app.listen(8080, () => {
console.log('listening on 8080')
})


// Wine = red or white - dynamic change
// Vqa = always
// sugar content = in a range
// cost = in a range

//
Loading

0 comments on commit c6252d8

Please sign in to comment.