-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (32 loc) · 922 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
31
32
33
34
35
36
37
38
39
40
const express = require('express')
const cors = require('cors')
const bodyParser = require('body-parser')
const store = require('./store')
const customersApi = require('./customers')
const customersJson = require('./js/customers.json')
const app = express()
app.use(cors())
app.use(express.static('public'))
app.use(bodyParser.json())
app.post('/uploadEtl1', (req, res) => {
store
.uploadEtl1({data: req.body.data})
.then(() => res.sendStatus(200))
})
app.post('/uploadEtl2', (req, res) => {
store
.uploadEtl2({data: req.body.data})
.then(() => res.sendStatus(200))
})
app.post('/uploadCustomersTable', (req, res) => {
store
.uploadCustomersTable({data: req.body.data})
.then(() => res.sendStatus(200))
})
app.use('/customers', customersApi)
app.use('/customersJson', (req, res) => {
res.send(customersJson)
})
app.listen(7555, () => {
console.log('Server running on http://localhost:7555')
})