Created
October 8, 2020 10:45
-
-
Save RyanKor/4e0f201652c7efd612735b9ab680eed2 to your computer and use it in GitHub Desktop.
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
const _formData = { | |
image: "image", | |
image: fs.createReadStream(path.join(__dirname + "/sean.jpg")), // , // FILE 이름 | |
}; | |
const _req = await request.post( | |
{ | |
url: api_url, | |
formData: _formData, | |
headers: { | |
"X-Naver-Client-Id": process.env.NAVER_CLIENT_ID, | |
"X-Naver-Client-Secret": process.env.NAVER_SECRET_KEY, | |
}, | |
}, | |
(err, response, body) => { | |
if (err) { | |
return console.error("upload failed:", err); | |
} | |
const jsonfy = JSON.parse(body); //body는 문자열이므로 객체화 시켜야함 | |
res.render("main", { body: jsonfy }); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment