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

244
Views
Undefined end-point http://localhost:8010/undefined/

I am trying to send data from front-end to back-end. Here is my front:

import axios from 'axios'

const api = axios.create({
  baseURL: `${process.env.BASE_FRONT_URL}`, // process.env.BASE_FRONT_URL = http://localhost:8010
})


export const postTip = async (payload) => {
  try {
    const { data } = await api.post(`post-tip`, payload);
    return data;
  } catch (e) {
    return [];
  }
};

And here is back-end:

const router = require('express').Router();

const tipController = require('../controllers/tips/tipController')

router.post('post-tip', tipController.postTip);

That function tipController.postTip actually just receive and shows data, but when I trigger this end-point I get error: POST http://localhost:8010/undefined/post-tip 404 (Not Found). So, what's wrong with end-point and how can I make it work? Also, I have no idea, where does this undefined come from? Am I missing something?

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

0

I have found my mistake. Actually process.env.BASE_FRONT_URL was really undefined, so, I made it like that:

import axios from 'axios'

const api = axios.create({
  baseURL: 'http://localhost:8084',
})


export const postTip = async (payload) => {
  try {
    const { data } = await api.post(`post-tip`, payload);
    return data;
  } catch (e) {
    return [];
  }
};

But the most important thing is that on back-end I have to use the same port (8084)

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!