1
0
Fork 0

Video 54: The Query String

This commit is contained in:
Jason Williams 2019-10-10 11:26:45 -06:00
parent 6116711a55
commit a34f5e05c3
1 changed files with 22 additions and 2 deletions

View File

@ -40,9 +40,29 @@ app.get('/help', (req, res) => {
})
app.get('/weather', (req, res) => {
if (!req.query.address) {
return res.send({
error: 'You must provide an address!'
})
}
res.send({
forecast: 'It is snowing. In September.',
location: 'Calgary'
forecast: 'It\'s pretty nice out. Not bad, really.',
location: 'Calgary',
address: req.query.address
})
})
app.get('/products', (req, res) => {
if (!req.query.search) {
return res.send({
error: 'You must provide a search term'
})
}
console.log(req.query.search)
res.send({
products: []
})
})