-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
21 lines (18 loc) · 838 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var cors = require("cors");
app.use(cors({credentials: true, origin: true}));
app.use(bodyParser.json());
app.get('/products', function (req, res) {
res.status(200).json([
{category: 'Sporting Goods', price: '$49.99', stocked: true, name: 'Football'},
{category: 'Sporting Goods', price: '$9.99', stocked: true, name: 'Baseball'},
{category: 'Sporting Goods', price: '$29.99', stocked: false, name: 'Basketball'},
{category: 'Electronics', price: '$99.99', stocked: true, name: 'iPod Touch'},
{category: 'Electronics', price: '$399.99', stocked: false, name: 'iPhone 5'},
{category: 'Electronics', price: '$199.99', stocked: true, name: 'Nexus 7'}
]
);
});
app.listen(1234);