Created
March 25, 2020 20:54
-
-
Save pironmind/ebef9af55934bcb954d9d53a9a913b0e to your computer and use it in GitHub Desktop.
Freelancehunt.com nodejs api
This file contains hidden or 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 http = require('axios') | |
const config = require('config'); | |
module.exports = ( | |
token=config.get('apiToken'), | |
apiBasePath='https://api.freelancehunt.com/v2/' | |
) => { | |
const instance = { | |
baseURL: apiBasePath, | |
timeout: 1000, | |
headers: { | |
"Authorization": `Bearer ${token}`, | |
"Accept-Language": `ru,en` | |
} | |
} | |
/** | |
* @url https://api.freelancehunt.com/v2/projects | |
* @return {Promise} | |
*/ | |
function projects() { | |
instance.method = 'get' | |
instance.url = `/projects` | |
let request = http.create(instance) | |
return request.get() | |
} | |
// another impl. methods. | |
// ... | |
return { | |
getProjects: projects | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment