-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (29 loc) · 880 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
/* eslint-disable no-magic-numbers */
const { http } = require('node-service-library');
const { DATA_URI } = require('./constants');
const dss = require('./lib')(DATA_URI);
module.exports = http({
GET: {},
POST: {
read: async ({ collectionName, query, page, limit }) => (
dss.read(collectionName, query, page, limit)
),
write: async ({ collectionName, query, payload }) => (
dss.write(collectionName, query, payload)
),
delete: async ({ collectionName, query, selection }) => (
dss.delete(collectionName, query, selection)
),
backup: async ({ collectionName }) => (
dss.backup(collectionName)
),
store: async ({ media, mediaType }) => (
dss.store(media, mediaType)
),
search: async ({ mediaAddress, mediaType }) => (
dss.search(mediaAddress, mediaType)
)
},
PUT: {},
DELETE: {}
});