-
Notifications
You must be signed in to change notification settings - Fork 31
/
app.js
37 lines (30 loc) · 975 Bytes
/
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
30
31
32
33
34
35
36
37
const AWS = require('aws-sdk');
const Store = require('s3-blob-store');
const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const BlobService = require('feathers-blob');
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
});
const blobStore = Store({
client: s3,
bucket: 'feathers-blob-store'
});
const blobService = BlobService({
Model: blobStore
});
// Create a feathers instance.
const app = express(feathers())
// Turn on JSON parser for REST services
.use(express.json())
// Turn on URL-encoded parser for REST services
.use(express.urlencoded({ extended: true }))
.use('/blobs', blobService);
// A basic error handler, just like Express
app.use(function (error, req, res, next) {
res.json(error);
});
// Start the server
module.exports = app.listen(3030);
console.log('feathers-blob-store service running on 127.0.0.1:3030');