Functions comes blank in the front end from express server


I created a module that exports a function. Im my express server, im trying to send this function to the front end, but it is coming blank.
Im using Axios API to get the data in the front end.

Im very newb with NodeJs and Express.

This is my code:

// Back End
function myFunction(){
    console.log("did work");
app.get("/getData", (req, res) => {
        randomData: randomData,
        myFunction: myFunction

// Front End

This is the data ta i get in the front end:

data that i get


JSON does not support functions.

If you want to send code, you would have to convert it to a string.

Answered By – Luís Henrique de Almeida

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published