The node version of the environment installation is up-to-date and will be released next month in 4.0, merging Io.js.
[Email protected] myexpressapp]$ node--versionv0.12.7
NPM version updates in NPM and node versions are different, and we want to update the NPM package frequently,
Express is an important web framework that is very well known in Hode. We can use the Express Generator tool to generate an express app.
Install the Express Generator tool :
Below we create an express application:
[Email protected] webstormprojects]$ Express Myexpressapp Create:myexpressapp create:myexpressapp/ Package.json create:myexpressapp/app.js create:myexpressapp/public create:myexpressapp/routes Create:myexpressapp/routes/index.js create:myexpressapp/routes/users.js create:myexpressapp/views Create:myexpressapp/views/index.jade Create:myexpressapp/views/layout.jade create:myexpressapp/views/ Error.jade create:myexpressapp/bin create:myexpressapp/bin/www create:myexpressapp/public/ JavaScripts create:myexpressapp/public/images create:myexpressapp/public/stylesheets Create: Myexpressapp/public/stylesheets/style.css Install dependencies: $ cd myexpressapp && NPM Install Run the app: $ debug=myexpressapp:* npm start
Follow the prompts:
To install an app dependency package:
[[email protected] webstormprojects]$ CD myexpressapp/[[email protected] myexpressapp]$ npm install[email protected] node_modules/cookie-parser├──[email protected]└──[email protected][email Protected] node_modules/debug└──[email protected][email protected] Node_modules/serve-favicon├──[email protected]├──[email protected]├──[email protected]└──[email protected][email Protected] node_modules/morgan├──[email protected]├──[email protected]├──[email protected]└──[ Email protected] ([email protected]) [email protected] node_modules/body-parser├──[email Protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected] ├──[email protected] ([email protected], [email protected]) ├──[email protected] ([email Protected]) ├──[email protected] ([email protected]) └──[email protected] ([email proteCTED], [email protected]) [email protected] Node_modules/express├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email Protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected] ├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected]├──[email protected] ([email Protected]) ├──[email protected] ([email protected]) ├──[email protected]├──[email protected] ([email protected], [email protected]) ├──[email protected] ([email protected], [email Protected]) ├──[email protected] ([email protected], [email protected]) └──[email protected] ([ Email protected], [email protected], [email protected], [email protected], [EMAIL&NBsp;protected]) [email protected] node_modules/jade├──[email protected]├──[email protected]├──[ Email protected]├──[email protected] ([email protected]) ├──[email protected] ([email protected], [email protected]) ├──[email protected] ([email protected]) ├──[email protected] ([ Email protected], [email protected]) ├──[email protected] ([email protected], [email protected], [email protected], [email protected]) ├──[email protected] ([email protected], [ Email protected], [email protected]) └──[email protected] ([email protected], [email protected]) [[email protected] myexpressapp]$
A basic Express application has been built and run:
[Email protected] myexpressapp]$ debug=myexpressapp:* npm start> [email protected] start/home/doctor/ webstormprojects/myexpressapp> node./bin/www myexpressapp:server Listening on port +0ms
or directly:
NPM start
If you make the editor code more prompt, you need to install Microsoft TypeScript Definition Manager (TSD).
NPM install-g TSD
Now we can download the definition file for node and express with TSD:
[[email protected] myexpressapp]$ TSD query Node-node/node [[email protected] myexpressapp]$ TSD query node--acti On Install-node/node >> running install. >> written 1 file: -Node/node.d.ts[[email protected] myexpressapp]$ TSD query express-express/express [ D[email protected] myexpressapp]$ TSD query Express--action install-express/express >> running install. >> written 1 file:
Write code is inseparable from the mode tool, it is a most sincere friend, along with your life.
Node Express I use Microsoft Open source vs code (do not spray Microsoft, at least people have started to contribute to open source, not as some companies take open source is closed), to let vs code can debug node Express, we need to install mono.
I still do not bother to download RAR package, decompression, configuration environment, DNF online installation bar.
Installation documentation in: http://www.mono-project.com/docs/getting-started/install/linux/#usage
Important things to repeat, important things to repeat:
CentOS, Fedora, and derivatives
Add the Mono Project GPG signing key and the package repository in a root shell with:
"http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
Run A package upgrade to upgrade existing packages to the latest available. Then install Mono as described in the Usage section.
Users of CentOS or RHEL (or similar distributions) may need to add the EPEL repository to their system T o Satisfy all dependencies.
[Email protected] ~]# rpm--import "http://keyserver.ubuntu.com/pks/lookup?op=get&search= 0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef "[[email protected] ~]# [[email protected] ~]# Yum-config-manager-- Add-repo http://download.mono-project.com/repo/centos/Yum-utils package have been deprecated, use DNF instead. See ' Mans YUM2DNF ' for more information. Repository pgdg94 is listed more than once in the Configurationrepository Pgdg94-source are listed more than once in the CO nfigurationadding Repo From:http://download.mono-project.com/repo/centos/[download.mono-project.com_repo_centos_ ]name=added from:http://download.mono-project.com/repo/centos/baseurl=http://download.mono-project.com/repo/ Centos/enabled=1[[email protected] ~]# DNF Install mono
Set a breakpoint: 14 lines:
Open the Debug view and the last one on the left side of the menu:
The program stops at the breakpoint. There is a small tool that can control the debugging process.
Copyright NOTICE: This article for Bo Master original article, without BO Master permission cannot reprint [http://blog.csdn.net/doctor_who2004].
Node Express creates a web App