Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
axios using wrong base url

I have a react project where I'm making requests to a third-party api. I created an axios file where I set a baseUrl for requests, and I export a function which will make a request to a particular endpoint.

However, when I import and execute the function in my App.js, the request is made with localhost:3000 as the base url. Can't figure out why

I made a sandbox to demonstrate

here is the code for my axios.js file

import axios from 'axios'


const instance = axios.create({
    baseUrl: `https://api.-----.com/svc/topstories/v2/`
})

export const api_key = '------------------------'

export const getTopStories = async () => {
    const {data: {results}} = await instance.get(`/home.json?api-key=${api_key}`)
    return results
}
export default instance


about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should use baseURL instead of baseUrl

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!