templates and urls paths. You can modify the configuration information in settings at will, but it must correspond to your app.
Model
Models is simple. we will create a table containing user and text. If you want to make it more complex, you can add information such as chatroom. (For the sake of simplicity, only two are written here)
from django.db import modelsfrom django.contrib.auth.models import User class Comments(models.Model): user = models
Socket. io, user node. as a server, js is used for Synchronous synchronization. For example, when a user logs on to a website, multiple windows of the browser are displayed after logon.
First, install socket. io and the required modules, reference the js package of socket. io in the project, and build the socket. io class
node. JS provides a simple modular system to allow node. js files to be called each other. Modules are a basic part of the node. JS application, and the files and modules are one by one corresponding. In other words, a
Document directory
I. Exploration of an error
Ii. Read and Write files
3. Analyze the Request Path
Iv. Mime
5. Complete
Series Directory: node. js Touch Stone series directory 1. Exploration caused by an error
The last time we obtained the 'user-agent' attribute of the headers attribute of the request object, I used the request. headers. thanks for the reminder from artwl, the User-Agent syntax can
Mongoose Library in short, a convenient package for manipulating MongoDB databases in the node environment, an object model tool similar to Orm,mongoose converts data from a database into JavaScript objects for you to use in your app.Of course, you have to install the Environment node. js and MongoDB = "MongoDB installationMongoDB is one of the most popular NoSQL
Node. js ------ Stream module1. The analysis stream at the beginning is an abstract interface implemented by many objects in Node. For example, a request to an HTTP server is a stream, and stdout is also a stream. Stream is readable, writable, or both. Stream was first introduced from the early unix era. Decades of pra
I started in January this year to contact node JS, contact the time is not long, so the technical level has yet to be improved, I hope this simple article can help you learn Nodejs.
I. Description of the project
1. Project Summary:
The main use of Nodejs to achieve a basic demo of the additions and deletions of the function of the Nodejs technology in the expansion of the development of the project preparat
variable db is the Foobar databaseSwitched to DB FoobarInserts a document into the collection, DB. Collection name. InsertDb.Blog.InsertObject * * When queryingShellDefault Maximum display20A matching document * * Returns all documents in the collectiondb. Blog. Find() //View a document in the collection db. Blog. FindOne() //Update document DB/blog. Update({title:' AA '}, Document Object) //Permanently delete the document from the database, deleting all document DB in the collection witho
Label: The MongoDB node. JS Driver is officially supported by the native node. JS driver, and he is by far the best implementation and has been supported by MongoDB official. The MONGODB team has adopted the MongoDB node. JS drive
Stream is an abstract interface, and there are many objects in Node that implement this interface. For example, the Request object requesting the HTTP server is a Stream and stdout (standard output).Node.js,stream has four flow types:
readable -readable operation.
writable -writable operation.
Duplex -readable writable operation.
Transform -The operation is written to the data and then
Node. js framework StrongLoop Study Notes (1)Node. js framework StrongLoop Study Notes (1)
I am using node. js is used as the mobile phone background, and the search framework finds that StrongLoop is quite suitable, but it find
the div by the react renderer.Reactdom.render (DOM node, the parent node being inserted);This code is the most commonly used is also a very necessary sentence. There is a very important place in this sentence is the HTML syntax and the JS syntax of the mix, which is the characteristics of JSX grammar, in the JSX syntax, encountered angle brackets in accordance w
node. JS Three features: single-threaded, nonblocking I/O, event-drivenFirst, create a HelloWorld1, the normal download installs the node. js package;2. cmd command, enter the directory where node. JS Installer is located: Cd:c:\p
the content of the entry file.Var fileContent = fs. readFileSync (filePath );// Traverse the File ContentFileContent. forEach (function (value ){// Here, findImport is the method that you need to implement. use regular expressions to match dependencies.Var matchFile = findImport (value );If (matchFile ){// If the dependency is matchedIf (! LoadedFileList [matchFile]) {// If the dependency is not in the weight list, recursively call combine.Combine (matchFile );ContentList. push ('\ n ');}} Else
node. JS Common ToolsUtil is a node. JS Core module that provides a collection of commonly used functions to compensate for the lack of the functionality of core JavaScript too thinly.Util.inheritsUtil.inherits (constructor, Superconstructor) is a function that implements prototype inheritance between objects.The objec
###################################################################################### #介绍node. js EventemitterAll asynchronous I/O operations of node. JS send an event to the event queue when it is finished.Many objects in node. JS
defines the successful execution of a functiondeferred.resolve(JSON.stringify(cols));
To define the error object for the function to fail successfullydeferred.reject(errfind);
Finally, a new promise object is returned toreturn deferred.promise;
4. Chained calls User.opendatabase ( "localhost", 27017, "test", "users". then (function (data) {return user.opencollection (Data[0],data[ 1])}). then (user.findcollectionnocondition). Done (function ' promise execution succeeded ');}, func
a simple example1 //Class.js2 varCLASS =function() {3 This. Say_hello = "Hello";4 };5 6CLASS.prototype.func =function() {7Console.log ("I say" + This. Say_hello);8 };9 TenModule.exports =NewCLASS ();Call method to1 var obj = require ("./class"); 2 obj.func ();
Single-Case modeSometimes we need the module to return a singleton singleton. Can be implemented using the above Method 1 and 4来. Which is the following two forms1 // Math.js 2 var MATH
."); - } - theExports.start = start; In this way, we can now create our main file index.js and launch our HTTP in it, although the server's code is still in server.js . Create the index.js file and write the following: 1 var server = require ("./server"); 2 3 server.start (); As you can see, we could use the server module just like any other built-in module: request this file and point it to a variable, where the exported function can be used by us.All right. We can now launch our app fro
Web AppsExpress is a minimalist, flexible Web application Development framework based on the node. JS platform that provides a range of powerful features to help you create a wide variety of web and mobile device applications.ApiRich HTTP shortcuts and any combination of Connect middleware make it fast and easy to create robust, friendly APIs.PerformanceExpress does not
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.