Skip to content

[Enhancement] Node.js proxy silently drops the type parameter #31

@Mohammad-Hassan027

Description

@Mohammad-Hassan027

Both the web app and the mobile app feature a dropdown/selector to choose between "Message" and "Email", and both frontends send this data in their POST request payloads ({ text: text, type: type }).

However, the Node.js backend (backend/server.js) strips this data out before forwarding the request to the Flask ML API:

const { text } = req.body;
// ...
const response = await axios.post(process.env.API, {
  text: text, // 'type' is not forwarded
});

While api.py doesn't currently utilize the type field, dropping it at the Node.js layer limits future extensibility. If the machine learning architecture is ever updated to route messages through different models or preprocessing steps depending on whether the input is an email or an SMS, this missing parameter will become a bottleneck.

Suggested Fix:
Modify server.js to forward the entire payload or explicitly extract and forward type:

const { text, type } = req.body;
// ...
const response = await axios.post(process.env.API, { text, type });

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions