Skip to content

Instantly share code, notes, and snippets.

@toughrogrammer
Created May 20, 2018 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toughrogrammer/6846da13da7ca82f847baffa85275640 to your computer and use it in GitHub Desktop.
Save toughrogrammer/6846da13da7ca82f847baffa85275640 to your computer and use it in GitHub Desktop.
const axios = require('axios');
const COGNITIVE_SERVICE_ENDPOINT ='https://southeastasia.api.cognitive.microsoft.com/face/v1.0';
const API_KEY = process.env.COGNITIVE_SERVICE_API_KEY;
module.exports = async function (context, req) {
const faceListName = req.query.name;
const addFaceListAPIEndpoint = COGNITIVE_SERVICE_ENDPOINT
+ '/facelists/' + faceListName;
const response = await axios.put(
addFaceListAPIEndpoint,
{
name: faceListName
},
{
headers: {
'Ocp-Apim-Subscription-Key': API_KEY,
'Content-Type': 'application/json'
}
}
);
context.res = {
status: 200
};
};
@toughrogrammer
Copy link
Author

toughrogrammer commented May 20, 2018

브라우저에서 ${MY_FUNCTION_APP_ENDPOINT}/api/createFaceList?name=my-face-list를 주소창에 붙여넣고 실행

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment