Objective
Nodejs is a JS, Google-based V8 engine that runs on the server. The personal blog system contains additions and deletions to the database, the function is complete, and the business logic is relatively simple, is a lot of background programmers in order to detect the results of learning, the first to take the practiced hand small website program. I also contacted at the end of last year Nodejs, then casually record the small blog function points and considerations.
Language and environment
1. Go to Nodejs's official website and download the NODEJS operating environment
This is what it looks like after the installation is complete.
2. Express is a Web development framework based on the Nodejs platform, access to the Express framework's official website to learn about express usage
3. Express-session Library for handling the library that holds session information
4. mysql library, a library for linking databases and executing SQL
5. Ejs Library, front template engine
6. Body-parser Library, library for processing post requests
7. Cookie-parser Library, processing cookie Library
NPM Install xxxxxx--save
Generate Package.json
NPM Init
Enter information for the project
Create a portal file
Create a file based on the entry file name entered in the Package.json file above index.js
/* Introducing Express */ var express=require ("Express"); var application=Express (); /* Creating a server */ var appport=process.env.vcap_app_port | | 8888; Application.listen (appport,function() { Console.log ("Application Start ... ");});
Open the browser, enter http://localhost:8888, shown below, indicating normal
[Nodejs] Nodejs Development Personal Blog (i) preparatory work