i'm bulding a simple nodejs rest service for a table in a mysql database, to do so i make server.js has these lines:
app.get('/Attivita',(req,res)=>{
res.status(200);
con.query('Select * from attivita', function (err, result) {
if (err)
throw err;
res.setHeader('Access-Control-Allow-Origin', 'http://isaplomb.org')
res.send(result)
})
});
it would return a json with the result of the query, it's correct, it works but in the table Attività there is a column called data that store the date in format date. node js returns a datetime value and it change the value of the date:
data stored in db: 2018-02-24 data returned from nodejs service: 2018-02-23T23:00:00.000Z
i need to show this date in an html page.
can anyone help me?