Sails is an intermediate Node. js architecture that helps us easily build web applications. And node. js and Sails log mechanisms have also been mentioned in this Article. If you need them, you can study them together. This article will start with the installation of sails a
Node. js and Sails ~ Project Structure and Mvc implementation and Log Mechanism, node. jssails
This article first introduces the Log Mechanism of node. js and sails from the installation of Sails. You can't wait to see the following, okay.
()
Other: A Different database connections can be configured in different model to facilitate multi-database support For example, the user table used in the login, can be placed in Redis, allowing users to log in faster Business details can be put into mongodb inside faster query Other relational logic data can be put into RDS libraries such as MySQL Pre-set in connections file before use. But I also found a little bug when I used Sails-redis,
* * * ****** *********************************************************************/Migrate:' Alter '//automatically merge without erasing the original data};Here are some instructions for migrate:
Safe-never auto-migrate My database (s). I will does it myself (by hand) [does not automatically merge data and requires manual control]
Alter-auto-migrate, but attempt to keep my existing data (experimental) [automatically merged with old data, when a new field is added, the datasheet wi
For some time did not write about Nodejs article, today is to solve the problem of high concurrency, and think of this thing, IIS site in concurrency reached 200 when there is a bottleneck, so think of this high concurrency support better framework, nodejs before I write some articles, Mainly for the sails framework, introduced a number of use methods, today the main Redis components!
Project: SAILSMVC
Development tools: Webstorm
Lang
Sails is a node. JS middleware architecture that helps us build Web applications easily, URL: http://www.sailsjs.org/, which is developed primarily on the basis of the express framework, expands the new functional components, Let's take a look at the installation methodOne installation sailsNpm-g Install sailsSecond, establish a sails projectNew TestProjectThree
In node. js, you can control the request and response, you can define your own response, such as how to respond to the text, how to respond to the JSON, how the image stream responds, and so on, which in the sails architecture, it becomes easier and clearer, it is located in the project's api/ In the responses directory, you can define your own response body.In fact, sa
only use JavaScript to verify that security is not secureEveryone knows that the answer is unsafe, very insecure. Because the validation at the client is the equivalent of "let the user authenticate themselves", it is obviously not reliable. You cannot avoid some malicious users who modify their own forms to deceive, or prevent third parties from intercepting the form after tampering and then committing.so, from a security standpoint, relying solely on JS
Jquery.validate Why the source code inside the DataType: "JSON" it?Because he matched the messages. The following remote property verification failure will work, and most importantly, I put dataType: "JSON" after the form is not submitted, validation failed, and then I can only follow the official wording. PublicJsonresult Chackvaluesloginaccount () {BOOLSuccess =false; varLoginaccount = request.form["Loginaccount"]. ToString (); varUSERTEMP = conn. Userinfo.where (X = X.loginaccount =
JS to verify the real name, is to use the Unicode character to match, and the Chinese name length is generally 2-4, so repeat the match {2,4} times1.js Verify real name 1 varRegname =/^[\u4e00-\u9fa5]{2,4}$/; 2 if(!regname.test (name)) { 3Alert (' real name is wrong '); 4 return false; 5}JS Authentication ID numbe
JS Authentication Login Registration Advantages, direct authentication in the foreground, do not need to read back in the background data validation, reduce server pressure.Login verification is necessary to intercept the malicious script logon registration attack.The JS code is as follows:$ (document). Ready (function
I in Firefox and Google want to delete the corresponding JS, because it is the external JS introduced, did not delete. Had to borrow the tools.This tool is not so big on, maybe we all used, httprequesterStep: Open Firefox Add-ons Manager--Extensions--Enter Httprequester, installInstall it as follows: note the Red box section.Click on the upper left corner of the red box, pop up, in 1 out fill your path, fil
the following:Http://www.cnblogs.com/xiawuyi/archive/2013/04/01/2990224.html a case of MVC.Http://jqueryvalidation.org/remote-method/the official example.My example:First find the Jquery.validate.js file find DataType: "JSON" and then comment on this line of code (I do not know why it does not want to support JSON, not the default text, or return data format customization is not good?)Some of the code is as follows: you don't have to.Data-msg-email= "Please enter the correct email address" plac
Some of the following to provide the number of JS verification phone number of the regular expression, is my collection from the Internet, but are fine, professional for mobile phone number and telephone number for verification.
function Checkphone (phone)
{
Verify the phone number of the phone number, including section 153,159
if (phone== "") {
Alert ("Phone number cannot be empty!");
return false;
}
if (Phone!= "") {
var p1 =/^ ([0+]d{2,3}-
This example describes JS authentication IP, subnet mask, gateway, and Mac methods. Share to everyone for your reference. as follows:
The wants this article to help you with your JavaScript programming.
The example of this article describes the method of JS authentication email address format. Share to everyone for your reference, specific as follows:
Example 1:
Copy Code code as follows:
function checkrate (input)
{
var re =/^[_ ". 0-9a-z-]+@ ([0-9a-z][0-9a-z-]+.) {1,4} [A-z] {2,3}$/i;
var nubmer = document.getElementById (input). value;
if (!re.test (Nubmer))
{
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.