我正在与 Angular 一起使用 Nodejs 来构建一个带有电容器的本机应用程序,并且我正在尝试在应用程序本身内构建一个 Web 服务器。我在本地主机服务器上测试应用程序,但它需要运行一个独立的,像这样的东西:
import { Component, OnInit } from '@angular/core';
import { Plugins } from '@capacitor/core';
import * as $ from 'jquery';
import * as http from 'http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app';
ngOnInit() {
$('#HelpBtn').click(function() {
$('#Info').fadeToggle()
})
}
btnClick() {
http.createServer(function (req, res) {
res.write('Hello World!'); //write a response to the client
res.end(); //end the response
}).listen(8080); //the server object listens on port 8080
}
}
它与电容器.js 一起运行,那么这两个框架中是否有任何内置组件或模块可以帮助我?最好是可以呈现 .html 文件的一种?像这样的东西