如何创建后端并将其集成到已完成的 angular 前端?

How do I create and integrate a backend to a finished angular frontend?

我用 Angular 4 学习前端有一段时间了,我用它构建了一个单页应用程序,该应用程序现在只是一个表单,现在我需要为它创建一个后端,我一直很难理解它,我最难理解的部分是如何创建一个适合我现有前端的后端?

我通常使用 apache 来为静态产品构建提供服务,然后让它指向您拥有的用于数据的 data.whateverDomain.com。所以我的组合是 angular、apache、nodejs。我将 angular 代码放在我的 /var/www/html 中然后离开...

看来你有点糊涂了。首先,你应该明白这个'backend'.

的目的是什么

您有很多编程语言(Java、Python、JS、C# 等)和不同的框架来创建后端。

很难相信您需要一个 Form-based 应用程序的后端,但无论如何您最好保持在 JS 语法的同一半球。看看 NodeJS here which you can use to instantly create a server or build a RESTful API

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
   res.statusCode = 200;
   res.setHeader('Content-Type', 'text/plain');
   res.end('Hello World\n');
});

server.listen(port, hostname, () => {
   console.log(`Server running at http://${hostname}:${port}/`);
});

我的建议是通过互联网阅读以了解这两个部分(前端和后端)如何交互以及每个部分的目的是什么。

祝你好运!