简体   繁体   English

离子应用程序的node.js服务器

[英]node.js server for ionic application

I am developing a mobile application using ionic framework. 我正在使用离子框架开发移动应用程序。 I want to use node.js for developing the server to make REST api calls. 我想使用node.js开发服务器来进行REST api调用。

Where should the node.js code be included in the project? 项目中应在何处包含node.js代码?

How to deploy such an app as apk? 如何将这样的应用程序部署为apk? and how to test it? 以及如何测试?

Ionic is based on cordova and it is used to create mobile applications in javascript. Ionic基于cordova,用于在javascript中创建移动应用程序。

Node.js is based on V8 and it is used to create backend (server) applications in javascript. Node.js基于V8,用于在javascript中创建后端(服务器)应用程序。

Node.js code cannot run on mobiles. Node.js代码无法在手机上运行。 So you have two seperate projects.One is the frontend ionic mobile app. 因此,您有两个单独的项目。一个是前端离子移动应用程序。 And the second is the backend nodejs app. 第二个是后端nodejs应用程序。

To make a connection between the two, as ionic uses angularjs take a look at angular's http service . 为了在两者之间建立联系,就像ionic一样使用angularjs,请看一下angular的http服务 After that you can organize your code in services . 之后,您可以在服务中组织代码。 For example: http_calls_service.js or api_service.js 例如: http_calls_service.js or api_service.js

As for the testing there are several frameworks to work with. 至于测试,有几个框架可以使用。 Take a look at this . 看看这个

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

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