我可以在WAMP Server上运行Angular 6项目吗? [英] Can I run an Angular 6 project on WAMP Server?

查看:68
本文介绍了我可以在WAMP Server上运行Angular 6项目吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名PHP开发人员,并且我已经使用Node.js后端开发了Angular 6应用程序.但是,目前我正在开发一个项目,该项目应运行带有PHP 7后端的Angular 6应用程序.原因是,API是用PHP编写的.我希望在WAMP服务器默认目录中开发Angular应用.

I am a PHP developer and also I have developed Angular 6 apps using Node.js backend. But, currently I am working on a project which should run an Angular 6 app with a PHP 7 back-end. The reason is that, the API was written in PHP. I wish to develop my Angular app in WAMP server default directory.

wamp64/www/my_project

我的问题是

  1. Angular 6应用程序将运行吗?因为它需要另一台服务器,通常是http://localhost:4200/.
  2. 会发生服务器(本地主机)冲突吗?
  3. 如果是,该怎么办?

  1. Will the Angular 6 app run? Because it needs another server and normally it is http://localhost:4200/.
  2. Would there any server (localhost) collisions?
  3. If it is, what should I do?

还可以在index.html(or .php)文件的开头运行<?php session_start();?>吗?

Also, can I run <?php session_start();?> on the beginning of index.html(or .php) file?

推荐答案

您可以仅使用Angular2软件包编写Angular2应用,而无需使用node或mamp或xampp并托管该应用.

如果您使用Angular2和node.js组合编写了任何内容,则可以将其托管在Heroku等免费服务上以进行测试.

If you have written any thing in Angular2 and node.js combination then you can host it on free services like Heroku for testing purpose.

并使用以下工具构建应用程序:

ng build --prod

ng build --prod

复制dist文件夹并将其粘贴到我的xampp htdocs文件夹中,然后使用以下方法访问网站:

copy dist folder and paste it in my xampp htdocs folder and access the site using:

localhost:8080/dist/

localhost:8080/dist/

输出

应用正常

这篇关于我可以在WAMP Server上运行Angular 6项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆