* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
18 lines
406 B
Markdown
18 lines
406 B
Markdown
---
|
|
title: Serve JSON on a Specific Route
|
|
---
|
|
# Serve JSON on a Specific Route
|
|
|
|
---
|
|
## Problem Explanation
|
|
|
|
It is rather simple to serve a JSON object with Node (at the `/json` route), if we want to deliver an object containing a key `message` and with the value `"Hello json"` we can do so as indicated:
|
|
|
|
```javascript
|
|
app.get("/json", (req, res) => {
|
|
res.json({
|
|
message: "Hello json"
|
|
});
|
|
});
|
|
```
|