2.0.6 • Published 6 years ago
intra42-fetch v2.0.6
Intra42-fetch
This is a little package which wrap node-fetch for request the api of the 42 school.
How to use it ?
const Intra42 = require('intra42-fetch')
// Instantiate the Intra42 class and provide your id and secret.
const intra42 = new Intra42(id, secret)
// Intra42.fetch is just a pre-applyed fetch with your token, use it like the fetch API
intra42.fetch('/v2/users')
.then(json => console.log(json)) // Response.json is used so you'll get json automatically
.catch(err => console.log(err)) // if the parsing failed the handle the error