Skip to content

response.response is undefined #3

@pp

Description

@pp

In DemoController.ts you return json with the key message:

return res.status(OK).json({
    message: DemoController.SUCCESS_MSG + name,
});

Therefore you should access response.message in App.tsx:

let response = await fetch('/api/say-hello/SeanMaxwell')
    .then(res => res.json());
alert('Hi this is a response from the backend: ' + response.response);

Otherwise the alert will display undefined instead of the message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions