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

421
Views
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 answers
Answer question

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 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!