From 2434c687bbc8f5b42b380a75e48cf1879a508674 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 20 Mar 2021 15:32:30 +0300 Subject: feat: initialize Uploads service --- src/services/index.ts | 2 ++ src/services/uploads.service.ts | 13 +++++++++++++ src/types.ts | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 src/services/uploads.service.ts create mode 100644 src/types.ts (limited to 'src') diff --git a/src/services/index.ts b/src/services/index.ts index 5ecbc15..2c3430c 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -4,6 +4,7 @@ import Contractors from './contractors.service'; import Waybills from './waybills.service'; import Tranfers from './transfers.service'; import Spreadsheets from './spreadsheets.service'; +import Uploads from './uploads.service'; export default (app: Application): void => { app.configure(Products); @@ -11,6 +12,7 @@ export default (app: Application): void => { app.configure(Waybills); app.configure(Tranfers); app.configure(Spreadsheets); + app.configure(Uploads); app.get('/ping', (req, res) => res.send('pong')); }; diff --git a/src/services/uploads.service.ts b/src/services/uploads.service.ts new file mode 100644 index 0000000..520079f --- /dev/null +++ b/src/services/uploads.service.ts @@ -0,0 +1,13 @@ +import { Application } from '@feathersjs/express'; +import blobService from 'feathers-blob'; +import fs from 'fs-blob-store'; +import Bluebird from 'bluebird'; +import _ from 'lodash'; + +const blobStorage = fs('./uploads'); + +const uploads = blobService({ Model: blobStorage }); + +export default (app: Application): void => { + app.use('/uploads', uploads) +}; diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..745d7f2 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,3 @@ +declare module 'fs-blob-store'; +declare module 'feathers-blob'; + -- cgit v1.2.3