Home > Web Front-end > JS Tutorial > body text

How to build a web server with AngularJS? The detailed process of building a web server with angularjs

寻∝梦
Release: 2018-09-08 16:59:54
Original
2335 people have browsed it

This article mainly introduces the operation of starting the web server in angularjs. I hope it can help everyone. Let’s start reading the article now

Install node.js

Download link

Official website address: https://nodejs.org/en/
The decompressed version I downloaded, directly decompress it into the directory you want to install.
In My Computer (right click)→Properties→Advanced System Variables→Environment Variables

Write NODE_PATH

How to build a web server with AngularJS? The detailed process of building a web server with angularjs

##Add to In path

node -v How to build a web server with AngularJS? The detailed process of building a web server with angularjsThe node version can be displayed on the console

 v6.11.4
Copy after login
Install the Web server

npm install connect
npm install serve-static
Copy after login

Write the server.js file, as shown in the book The version is version 2.x, now it is version 3.x, the code in the book is invalid, put the file in the nodejs installation directory

var connect = require('connect');
    serveStatic = require('serve-static');
var app = connect();
app.use(serveStatic("../angularjs"));
app.listen(5000);
Copy after login

AngularJS settings

Create a new angularjs folder and nodejs installation directory level


How to build a web server with AngularJS? The detailed process of building a web server with angularjs

In the folder, you need to prepare the bootstrap css file and angular.js

angularjs folder download address: click to download
Create a new FirstTest.html in the angularjs folder

<!DOCTYPE html><html ng-app><head>
    <title> First Test</title>
    <script src="angular.js"></script>
    <link href="bootstrap.css" rel="stylesheet" />
    <link href="bootstrap-grid.css" rel="stylesheet" /></head><body>
    <p class="btn btn-dark">{{ "AngularJS" }}</p>
    <p class="btn btn-success">Bootsstrap</p></body></html>
Copy after login

Start the web server

Jump to the nodejs installation directory

node server.js
Copy after login

View the browser http://localhost:5000/FirstTest .html

The effect is as follows:


How to build a web server with AngularJS? The detailed process of building a web server with angularjs

This article ends here (if you want to see more, go to the PHP Chinese website

AngularJS User Manual column), if you have any questions, you can leave a message below.

The above is the detailed content of How to build a web server with AngularJS? The detailed process of building a web server with angularjs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!