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

15 lines
606 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) 。