-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (23 loc) · 929 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//Bring in the express server and create application
let express = require ('express');
let app = express();
//Use the express Router object, we need to be able to 'route' to things
let router = express.Router();
//For now using simple example of pies until can revist a more effective way to approach this
let pies = [
{ "id": 1, "name": "Apple"},
{ "id": 2, "name": "Cherry"},
{ "id": 3, "name": "Peach"},
];
//using example of sending apple but this will hold all 72 cards of the Rider-Waite Deck
//Create GET to return a list of all tarot cards
router.get('/', function (req, res, next) {
//response object, send out the text 'apple'
res.send("Apple");
});
//Configure router so all routes are prefixed with /api/v1
app.use('/api/', router);
//Create server to listen on port 5000
var server = app.listen(5000, function () {
console.log('Node server is running on http://localhost:5000..');
});