-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from boostcamp-2020/dev
v0.0.4 배포
- Loading branch information
Showing
40 changed files
with
1,192 additions
and
145 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import AWS from 'aws-sdk' | ||
require('dotenv').config() | ||
|
||
const S3 = new AWS.S3({ | ||
endpoint: process.env.S3_ENDPOINT, | ||
region: process.env.S3_REGION, | ||
credentials: { | ||
accessKeyId: process.env.S3_ACCESSKEY, | ||
secretAccessKey: process.env.S3_SECRETKEY, | ||
}, | ||
}) | ||
|
||
const BUCKETNAME = process.env.S3_BUCKETNAME | ||
|
||
module.exports = { S3, BUCKETNAME } |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { asyncWrapper } from '../../util' | ||
import service from '../../service/file' | ||
|
||
exports.getFileURL = asyncWrapper(async (req, res) => { | ||
const { code, success, data } = await service.getFileURL({ | ||
...req.query, | ||
}) | ||
return res.status(code).json({ success, data }) | ||
}) | ||
|
||
exports.uploadFile = asyncWrapper(async (req, res) => { | ||
const { code, success, data } = await service.uploadFile({ | ||
file: req.file, | ||
userId: req.user.id, | ||
}) | ||
return res.status(code).json({ success, data }) | ||
}) | ||
|
||
exports.deleteFile = asyncWrapper(async (req, res) => { | ||
const { code, success } = await service.deleteFile({ | ||
...req.query, | ||
}) | ||
return res.status(code).json({ success }) | ||
}) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import express from 'express' | ||
const { Auth } = require('../../middleware/auth') | ||
const router = express.Router() | ||
const controller = require('./file') | ||
|
||
const multer = require('multer') | ||
const storage = multer.memoryStorage() | ||
const uploader = multer({ storage: storage }) | ||
|
||
router.get('/', Auth, controller.getFileURL) | ||
router.post('/', Auth, uploader.single('file'), controller.uploadFile) | ||
router.delete('/', Auth, controller.deleteFile) | ||
|
||
module.exports = router |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import express from 'express' | ||
|
||
import channelCotroller from './channel' | ||
import searchCotroller from './search' | ||
import userController from './user' | ||
import workspaceController from './workspace' | ||
import chatController from './chat' | ||
import fileController from './file' | ||
const router = express.Router() | ||
|
||
router.use('/channel', channelCotroller) | ||
router.use('/search', searchCotroller) | ||
router.use('/user', userController) | ||
router.use('/workspace', workspaceController) | ||
router.use('/chat', chatController) | ||
router.use('/file', fileController) | ||
|
||
module.exports = router |
This file contains 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
This file contains 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
Oops, something went wrong.