Last active
April 7, 2019 19:48
-
-
Save Rowadz/7cafab33946f4e8807ec6db3781b97e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function (app) { | |
| return async (req, res, next) => { | |
| const { | |
| files | |
| } = req; | |
| const fileRes = []; | |
| const seq = app.get('sequelizeClient'); | |
| const { media } = seq.models; | |
| for (const file of files) { | |
| fileRes.push( | |
| await media.create({ | |
| path: file.path | |
| }) | |
| // OR | |
| // await app.service('media').create({ | |
| // path: file.path | |
| // }) | |
| ); | |
| } | |
| res.json(fileRes); | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment