Skip to content

Instantly share code, notes, and snippets.

@pironmind
Created March 25, 2020 20:54
Show Gist options
  • Save pironmind/ebef9af55934bcb954d9d53a9a913b0e to your computer and use it in GitHub Desktop.
Save pironmind/ebef9af55934bcb954d9d53a9a913b0e to your computer and use it in GitHub Desktop.
Freelancehunt.com nodejs api
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