Nodejs Study Notes

Source: Internet
Author: User

The afternoon followed Daniel's blog to start learning node (https://github.com/nswbmw/N-blog/wiki/_pages),

A simple blog system to summarize the problems encountered and solutions, as well as some knowledge points

ps:os:win8+node:0.12.7 +chorme+sublime 3

1.express New Project

New project, there is always reported that cannot find modules xxx problems, according to the prompts a NPM install can

2.****

2. Routing rules

  

    • req.query: Processing get requests, getting GET request parameters
    • req.params: Handles get or post requests in/:xxx form, gets request parameters
    • req.body: Process POST request, get POST request body
    • req.param(): Handles get and post requests, but finds priority from high to low to Req.params→req.body→req.query

3.XSLT (extended style sheet conversion language)

Refers to XSL transformations, converting XML to other documents such as XHTML

4. Route control method---equivalent to controller in---MVC

Template engine View

Data Object Models

5.

The HTTP protocol is stateless and does not natively support sessions, so with the help of no additional means, the server in the previous scenario does not know what the user has purchased.

To implement a session on top of a stateless HTTP protocol, the Cookie was born. Cookies are information stored on the client, which is submitted by the browser to the server each time the connection is made, and the server initiates a request to the browser to store the cookie, depending on the way the server can identify the client. This is how the HTTP session function in our usual sense is implemented. Specifically, when the browser initiates a request to the server for the first time, the server generates a unique identifier and sends it to the client browser, which stores the unique identifier in a Cookie and the client browser sends the unique identifier to the server each time it is requested. The server uses this unique identifier to identify the user. For developers, there is no need to care about browser-side storage, just how to identify users with this unique identifier. Many server-side scripting languages have conversational features, such as PHP, that store each unique identifier in a file.

6.flash is a specific area that is used to store information in the session

Information is written to Flash, and the next time it is displayed, it is clear

A typical application is a feature that combines redirection to ensure that information is provided to the next rendered page

7. Always follow the code of others, do not write some of their own things will not grow, so I intend to follow the system to write something, specifically can write a what, see the Night ~

Nodejs Study Notes

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.