Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. const axios = require('axios')
  2.  
  3. const client = axios.create({
  4. baseURL: 'https://api.github.com/',
  5. responseType: 'json',
  6. headers: {
  7. 'Accept': 'application/vnd.github.v3+json application/vnd.github.inertia-preview+json', //create new project
  8. 'Accept': 'application/vnd.github.inertia-preview+json', //teams
  9. 'Accept': 'application/vnd.github.nebula-preview+json', //repos
  10. 'Authorization': 'token 491f783188ad31909826972fd2ec40bd41277ceb'
  11. }
  12. });
  13. // client.post('/orgs/ACME-3818/projects', {
  14. // "name": "test project ACME-3818"
  15. // })
  16.  
  17. // client.get('orgs/ACME-3818/projects')
  18. // .then(function (response) {
  19. // console.log(response);
  20. // })
  21. // .catch(function (error) {
  22. // console.log(error);
  23. // });
  24.  
  25. // client.post('orgs/ACME-3818/teams', {
  26. // "name": "frontend-developers"
  27. // });
  28.  
  29. client.post('orgs/ACME-3818/repos',{
  30. name: "backend",
  31. team_id: "backend-developers"
  32. })
  33. .then(function(response){
  34. console.log(response);
  35. })
  36. .catch(function(response){
  37. console.log(response)
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement