Skip to content

Commit

Permalink
Add cors.
Browse files Browse the repository at this point in the history
Add price to the fakedata.
  • Loading branch information
Zachary Smith committed Dec 13, 2015
1 parent d4d4bc3 commit 5eb9ca7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fakedata.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{"catalog":[{"id":1,"name":"Item 1","description":"Item 2 description"},{"id":2,"name":"Item 2","description":"Item 2 description"},{"id":3,"name":"Item 3","description":"Item 3 description"},{"id":4,"name":"Kyle","description":"Handsomest"}]}
{"catalog":[
{"id":1,"name":"Honey", "price": "3.50", "description":"Sweet stuff"},
{"id":2,"name":"Almonds", "price": "5.55", "description":"Fucking nuts"},
{"id":3,"name":"Lentils", "price": "0.99", "description":"Small and round"}
]}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"license": "ISC",
"dependencies": {
"body-parser": "^1.14.1",
"cors": "^2.7.1",
"express": "^4.13.3"
}
}
5 changes: 5 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ var express = require('express');
var db = require('./fakedata.json');
var bodyParser = require('body-parser');
var fs = require('fs');
var cors = require('cors')

var app = express();

app.listen(8080);
console.log('Server running on port 8080');

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


app.get('/', function(req, res) {
res.send('Hello World');
Expand Down

0 comments on commit 5eb9ca7

Please sign in to comment.