Skip to content

Instantly share code, notes, and snippets.

@kevireilly
Forked from FredLoh/app.js
Last active January 26, 2016 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevireilly/3730e2d4d822620b9a4e to your computer and use it in GitHub Desktop.
Save kevireilly/3730e2d4d822620b9a4e to your computer and use it in GitHub Desktop.
app.get("/api", function(req, res) {
if (req.query.lon === "" || req.query.lat === ""
|| req.query.lon = null || req.query.lat = null) { // handle undefined as well
res.sendStatus(404).json({ error: 'Latitude and longitude are required' });
} else {
console.log(req.query);
res.json(req.query);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment