Nodejs Study notes (2)

Source: Internet
Author: User

1. Express Timeout setting

If the HTTP request does not return a value for a period of time, Express sends the request back to the background. In the case of a long background method execution, repeated requests will be repeated, causing the foreground to receive an empty response, a err_empty_response error, suspected because a long time no response,express automatically return the status code to the foreground.

According to the actual measurement, express default wait time seems to be 4 minutes (in doubt), to change the default wait time needs to be in the project startup script, the following settings

1 varApp = require ('.. /app ');2 varPort = normalizeport (URL | | ' 13000 ');3App.set (' Port ', port);4 5 varServer =Http.createserver (app);6 Server.listen (port);7Server.timeout = 600000;//set the wait time to ask 600 seconds, i.e. 10min8Server.on (' ERROR ', onError);9Server.on (' Listening ', onlistening);

2, DataTables front page and background paging

DataTables Remove "serverside": True, properties, set pagination for the front page, adjust the number of page display bar can be updated immediately display number, do not need to re-read background data.

With less data returned in the background, taking the foreground paging can speed up the page turn and improve the user experience.

Nodejs Study notes (2)

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.