Files
2018-10-16 21:32:40 +05:30

15 lines
910 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Serve JSON on a Specific Route
localeTitle: Служить JSON на определенном маршруте
---
## Служить JSON на определенном маршруте
Довольно просто обслуживать объект json с узлом (по маршруту «/ json»), если мы хотим доставить сообщение и дать ему значение «Hello World», мы можем сделать это следующим образом:
```javascript
app.get("/json", function(req, res) {
res.json({"message": "Hello World"});
});
```
[Помогите нашему сообществу расширить эти подсказки и руководства](https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md) .