forked from brendan-jarvis/finance-npm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
32 lines (25 loc) · 823 Bytes
/
routes.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
31
32
const express = require('express')
const router = express.Router()
const utils = require('./utils')
router.get('/', function (req, res) {
utils.readFile('./data.json', req, res, 'home')
})
router.post('/', function (req, res) {
utils.searchCurrent(req, res, 'currentResults')
// res.send(req.body)
})
router.get('/historical', function (req, res) {
utils.readFile('./data.json', req, res, 'historical')
})
router.post('/historical', function (req, res) {
utils.searchHistorical(req, res, 'results')
// res.send(req.body)
})
router.get('/stocks/:symbol', function (req, res) {
utils.readDetails('./data.json', req, res, 'details')
})
router.get('/example', function (req, res) {
utils.readFile('./data.json', req, res, 'example')
})
//export this router to use in our index.js
module.exports = router