Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

432
Vistas
How can I fix my endpoint not accepting POST requests?

I'm building a custom API, with an endpoint defined as follow:

API Endpoint Spec

I have a created a Profiling Controller to handle the logic for this endpoint. My controller directory contains 2 files:

  1. controller.ts
import { Request, Response } from 'express';
import ProfilingService from '../../services/profiling.service';

export class Controller {
  enrich_profile(req: Request, res: Response): void {
    console.log(req);
    ProfilingService.enrich_profile(req).then((r) =>
      res
        .status(201)
        .location(`/api/v1/profile_data/enrich_profile/data${r}`)
        .json(r)
    );
  }
}
export default new Controller();
  1. routes.ts
/* eslint-disable prettier/prettier */
import express from 'express';
import controller from './controller';
export default express.
    Router()
    .post('/enrich_profile', controller.enrich_profile)
;

However, when I sent a call to the endpoint, I get the following error:

API Endpoint Error Message

And finally, to allow a full picture, here's the content of profiling.service.ts:

import L from '../../common/logger';

interface Profiling {
  data: never;
}

export class ProfilingService {
  enrich_profile(data: never): Promise<Profiling> {
    console.log(data);
    L.info(`update user profile using \'${data}\'`);
    const profile_data: Profiling = {
      data,
    };
    return Promise.resolve(profile_data);
  }
}

export default new ProfilingService();

The error clearly states that POST to the defined endpoint is not possible, and I'm not sure I understand why.

How can I fix this issue?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm not sure what was causing the issue, but after cleaning my npm cache, and deleting node_modules about 100X, the issue finally went away.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda