Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

사진 업로드 API #124

Open
2 tasks
perArdua opened this issue Nov 27, 2023 · 0 comments
Open
2 tasks

사진 업로드 API #124

perArdua opened this issue Nov 27, 2023 · 0 comments
Assignees
Labels
BE 백엔드 관련 이슈 FE 프론트엔드 관련 이슈

Comments

@perArdua
Copy link
Collaborator

perArdua commented Nov 27, 2023

기능 소개
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

TODO

  • TODO1
  • TODO2

ETC

참고자료

NCP 공식문서

AWS 공식문서

블로그

aws S3 sdk를 쓰긴하지만 NCP bucket에 올라가기 때문에
https://guide.ncloud-docs.com/docs/storage-storage-8-4 이 문서를 참고하는게 좋아보임

const AWS = require('aws-sdk');
const fs = require('fs');
const endpoint = new AWS.Endpoint('https://kr.object.ncloudstorage.com');
const region = 'kr-standard';
const access_key = 'ACCESS_KEY';
const secret_key = 'SECRET_KEY';


const S3 = new AWS.S3({
    endpoint: endpoint,
    region: region,
    credentials: {
        accessKeyId : access_key,
        secretAccessKey: secret_key
    }
});


const bucket_name = 'sample-bucket';
const local_file_path = '/tmp/test.txt';



(async () => {

    let object_name = 'sample-folder/';
    // create folder
    await S3.putObject({
        Bucket: bucket_name,
        Key: object_name
    }).promise();

    object_name = 'sample-object';

    // upload file
    await S3.putObject({
        Bucket: bucket_name,
        Key: object_name,
        ACL: 'public-read',
        // ACL을 지우면 전체 공개되지 않습니다.
        Body: fs.createReadStream(local_file_path)
    }).promise();

})();

S3.putObject 함수가 아닌 presigned url 만드는 방법

@perArdua perArdua added the BE 백엔드 관련 이슈 label Nov 27, 2023
@seungy0 seungy0 added the FE 프론트엔드 관련 이슈 label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 관련 이슈 FE 프론트엔드 관련 이슈
Projects
Status: Sprint Backlog
Development

No branches or pull requests

3 participants