набираю
http://localhost:3000/somesmart/?id=9 выдает ошибку Cannot GET /somesmart/
вот код
app.get('/somesmart/:id', function(req, res) {
// Connect to MySQL database.
var somesmart = [];
var connection = getMySQLConnection();
connection.connect();
// Do the query to get data.
connection.query('SELECT `prod`,`name`,`sim`,`display`,`razresh`,`acum`,`proc`,`oper`,`sd`,`cam`,`gps`,`description`,`giroscope`,`payment`,`photo` FROM `smartphone` WHERE '+req.params.id, function(err, rows, fields) {
if (err) {
res.status(500).json({"status_code": 500,"status_message": "internal server error"});
} else {
// Loop check on each row
for (var i = 0; i < rows.length; i++) {
// Create an object to save current row's data
var smart = {
'prod':rows[0].prod,
'name':rows[0].name,
'sim':rows[0].sim,
'display':rows[0].display,
'razresh':rows[0].acum,
'acum':rows[0].acum,
'proc':rows[0].proc,
'oper':rows[0].oper,
'sd':rows[0].sd,
'cam':rows[0].cam,
'gps':rows[0].gps,
'description':rows[0].description,
'giroscope':rows[0].giroscope,
'payment':rows[0].payment,
'photo':rows[0].photo
}
// Add object into array
somesmart.push(smart);
}
res.render('somesmart', {"somesmart": somesmart});
}
});
// Close MySQL connection
connection.end();
});