How to make an alert in the browser, using node.js

0

I'm beginner in node.js , I know the main function of the node is not this, however I want to learn a little more about this event, another doubt that I also have is if I can use common javascript functions in the middle of my code node. I would like a way to add my javascript without the fs.readFile () function

Thank you for your attention!

    
asked by anonymous 27.07.2017 / 06:19

1 answer

1

If you use ajax you can do this:

On the server side

 res.send(500,'Errooooou')

and client side

error: function(error){
      if(error.responseText == 'Errooooou')
          alert("Sua resposta está errada.")
    
27.07.2017 / 07:15