-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 1.05 KB
/
app.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
const express = require('express')
const bodyParser = require('body-parser');
const items = require('./controller/items');
const schemas = require('./controller/schemas');
const provision = require('./controller/provision');
const { wrapError, errorMiddleware } = require('./utils/errorMiddleware')
const authMiddleware = require('./utils/authMiddleware')
const app = express()
const port = process.env.PORT || 8080;
app.use(bodyParser.json())
app.use(authMiddleware)
app.post('/schemas/find', wrapError(schemas.findSchemas))
app.post('/schemas/list', wrapError(schemas.listSchemas))
app.post('/data/find', wrapError(items.findItems))
app.post('/data/get', wrapError(items.getItem))
app.post('/data/insert', wrapError(items.insertItem))
app.post('/data/update', wrapError(items.updateItem))
app.post('/data/remove', wrapError(items.removeItem))
app.post('/data/count', wrapError(items.countItems))
app.post('/provision', wrapError(provision.provision))
app.use(errorMiddleware)
app.listen(
port,
() => console.log(`Firestore connector listening on port ${port}!`))