분류 Nodejs

gh-got - GitHub API와 상호 작용할 수 있는 편리한 래퍼.

컨텐츠 정보

  • 조회 272 (작성일 )

본문

https://github.com/sindresorhus/gh-got


const got = require('got');
const token = 'foo';

(async () => {
	const {body} = await got('https://api.github.com/users/sindresorhus', {
		json: true,
		headers: {
			'accept': 'application/vnd.github.v3+json',
			'authorization': `token ${token}`
		}
	});

	console.log(body.login);
	//=> 'sindresorhus'
})();