the Dashboard page, you need to execute the following calls:
User information-getUserProfile ().
Current Activity-getRecentActivity ().
Subscription content-getSubscriptions ().
Notification content-getNotifications ().
To obtain this information, you should create independent middleware for each method and link them to the Dashboard route. However, the problem is that the execution of these methods is linear, And the next method will not start befor
file under the installation directory is:
Js Code
Var http = require ('http'); http. createServer (function (req, res) {res. writeHead (200, {'content-type': 'text/html; charset = UTF-8 '}); res. end ('I am using Node. js write program ');}). listen (4000, "127.0.0.1"); console. log ('server running at http: // 127.0.0.1: 4000 /');
Then go to the installation
on.
The above code we completed a working HTTP server, that is, the above code we can complete a local server build, when we run the above code, a local server began to run, we only need to open the browser to this server to send a request, This server will return your defined return data to the browser (to learn more about node. js, go to topic.alibabacloud.comnode.js Chinese Reference manual section)
Use
http = require ('http'); http. createServer (function (req, res) {res. writeHead (200, {'content-type': 'text/html; charset = UTF-8 '}); res. end ('I am using Node. js Write Program \ n ');}). listen (4000, "127.0.0.1"); console. log ('server running at http: // 127.0.0.1: 4000 /');
Then go to the installation directory on the terminal. For example, if the drive C is just opened, we will install it on disk
This article describes how to create a web calculator using node. js + express. For more information, see
Environment:
HOST: WIN10
Express installation:
1. Install express-generator
Enter the following command:
npm install -g express-generator
2. Install express
Enter the following command:
npm install -g express
3. verify whether the installation is successful
Enter the command: express-V
View help: e
attributes:
1,error.message-Error message
2,error.stack -Error stack tracing information
In addition to the attributes of the Error instance, you can also customize some Error attributes. For example, to customize an attribute status that indicates the status:
Var error = new Error ('the page you accessed does not exist'); error. status = 404;
2.2 System Error
System Error: JavaScript ErrorErrorAn extension of the object, which indicates the operatio
callback function has complicated the code, and the exception handling in asynchronous mode has increased the complexity of the Code.
Articles you may be interested in:
Asynchronous Concurrency Control in Nodejs crawler advanced tutorial
Nodejs implements the bigpipe asynchronous page loading scheme
In-depth analysis of node. js concurrent asynchronous callb
Node. js for front-end pig and Node. js for pigFront-end pig flying traditional front-end pig most of the work is the page layout, rendering and animation effects, playing with is always a web shell, because there is no background support, this always makes front-end pig fee
Node. js Learning (2)-routing function and form upload, node. js form
Today. getting started with js this book has learned some basic knowledge about node, including server creation, implementation of routing functions, form uploa
very troublesome, but we can solve the problem through a module$ npm install -g supervisorInstall supervisor. Start app.js with the Supervisor command:$ supervisor app.jsThis does not have to turn off every time and then open, but in fact, so when the code is wrong, it will always restart execution, difficult to see the wrong hint, in fact, not good.3. MiddlewareWhat is middleware, in fact, this I also want to find a lot of information, behind the discovery of simple as PHP plug-ins, introduced
After you install node. js, choose a beneficial IDE for your development.After comparing multiple Ides, it is positioned on webstrom and sublime.There is a simple comparison:Webstorm feature is very rich, the front-end development tool of the synthesizer, compared to sublime slightly heavierSublime plug-in is also very rich, the interface is more beautiful, very light, also has a simple project management f
Node. js blog instance (7) Paging function, node. js Paging
Original tutorial.
Adds the paging function to the homepage and user pages of a blog. Set: up to 10 articles can be displayed on each page of the home page and user page.
When we use PHP to write background code, we need to use Apache or Nginx HTTP server, with MOD_PHP5 modules and php-cgi.From this perspective, the entire "Receive HTTP request and provide Web page" requirement does not need PHP to handle at all.But for node. JS, the concept is completely different. When using node.
Node. js blog instance (6) message function, node. js instance
Original tutorial.
This function enables users to leave messages for articles. The messages are stored in the database.
Post. js, modify the document to be saved in Post. prototype. save as follows:
// Var post
Node. js blog instance (5) Editing and deletion functions, node. js instance
Original tutorial.
Now, you can edit or delete an article for a blog.
When a user is online, he or she is allowed to edit or delete only the published article pages. When editing, he or she can only edit the article content, not the title of t
This article mainly introduces how to use Node in MacOS. simple js tutorial, Node. js is a framework that allows JavaScript applications to run on the server. If you need JavaScript, you can refer to this article for a good Node. js
This article mainly introduces how to use Node in MacOS. simple js tutorial, Node. js is a framework that allows JavaScript applications to run on the server. if you need JavaScript, you can refer to this article for a good Node. js
you press enter, you will see:Copy codeThe Code is as follows:Express server listening on port 3000Great. Open your browser and enter http: // localhost: 3000. You should be able to see a welcome page of Express.
Now you have run your own Node JS WebServer with the Express engine and Ejs HTML template engine. Not very difficult, right?
Part 1-now, let's write
(index.html) for browser requests
3. Test
(1) first, start the server, open cmd, find the project location, and then enter the command node server. js to start the server.
(2) access in the browser. In the url bar, enter http: // 127.0.0.1: 888/index.html
If the corresponding page is displayed, it indicates that you have succeeded. Next, I will introduce nodejs
Node. js entry-create a project and explain it in detail. node. js entry-level
After thinking for a long time, I always want to write something that is helpful to everyone. Today I will explain how to generate a project.
At present, the market generally requires a full stack of people ----- mean (mongo, express, angula
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.