如何创建本地主机服务器来运行 AngularJS 项目 [英] How to create a localhost server to run an AngularJS project
问题描述
我使用 Xampp 和 JetBrain WebStorm 来运行 AngularJS 项目.但是很复杂,性能低.有没有其他方法可以运行AngularJS项目?
i have used Xampp and JetBrain WebStorm to run an AngularJS project. But it's complicated and low performance.Is there any other way to run an AngularJS project?
推荐答案
如果你正在运行 node.js http-server 是一种提供本地文件的超级简单方法.
If you're running node.js http-server is a super easy way to serve local files.
cd
进入您的项目文件夹和
cd
into your project folder and
npx http-server -o
# or, install it separately so you don't need npx
npm install -g http-server
http-server -o
-o
是打开浏览器到页面.运行 http-server --help
查看其他选项,例如更改端口号
-o
is to open browser to the page. Run http-server --help
to view other options such as changing the port number
这些其他单行代码如果您没有 可能会更容易node
/npm
已安装.
these other one-liners might be easier if you don't have node
/npm
installed.
例如,python 预装在大多数系统上,所以下面的 John Doe 的 python 服务器会更快.
For example python comes preinstalled on most systems, so John Doe's python servers below would be quicker.
MacOS 随 ruby 一起安装,因此如果您运行的是 Mac,这是另一个简单的选择:ruby -run -ehttpd .-p8000
并打开浏览器到 http://localhost:8000
.
MacOS comes installed with ruby, so this is another easy option if you're running a Mac:
ruby -run -ehttpd . -p8000
and open your browser to http://localhost:8000
.
这篇关于如何创建本地主机服务器来运行 AngularJS 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!