简体   繁体   English

如何在Node.js中创建Restful API?

[英]how can i make restful API in nodejs?

I want to create restful API in nodejs for my android application.But after watching so many videos and different patterns i'm bit confuse.Can anone guide me and show the complete roadmap to create APIs and how to deploy nodejs APIs on online server with mongoDB database. 我想为我的Android应用程序在nodejs中创建Restful API。但是在观看了如此多的视频和不同的模式后,我有点困惑。有人可以指导我并展示完整的路线图来创建API以及如何使用以下方法在在线服务器上部署Nodejs API mongoDB数据库。 Please help me out! 请帮帮我!

The best way to create restful APIs is using express , they have great documentation and a begginner friendly starting guide . 创建Restful API的最佳方法是使用express ,它们具有出色的文档和入门指南 After you have a bit of experience with it the mongodb library to go is mongoose and they also have a starting guide . 在您有了一些经验之后,要使用的mongodb库就是猫鼬了 ,他们也有一个入门指南 To learn how to combine and create a API with these I found a nice guide here . 为了学习如何结合使用它们并创建API,我在这里找到了不错的指南。

As Alex answered the question on how to build a Restful API and communicate with a mongoDB database, I will explain how to deploy the application online. 当Alex回答有关如何构建Restful API并与mongoDB数据库通信的问题时,我将解释如何在线部署应用程序。 I would have done it in the comment section under Alex's post if only I had enough reputation. 如果只有我有足够的声誉,我会在Alex帖子下的评论部分中做到这一点。

If your looking for a free solution, have a look at Heroku which is really easy to use. 如果您正在寻找免费的解决方案,请看一下真正易于使用的Heroku They have a starting guide as well to help you push your code online. 他们也有一个入门指南 ,可以帮助您将代码在线发布。

Heroku works with add-ons that can be plugged to your application. Heroku使用可插入您的应用程序的加载项。 Every applications can be provided with add-ons, such as a database, to extend its functionalities. 可以为每个应用程序提供附加组件,例如数据库,以扩展其功能。 I suggest the mLab MongoDB add-on which propose a free plan. 我建议建议免费计划的mLab MongoDB插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM