在vscode中使用node

来源:

https://code.visualstudio.com/docs/nodejs/nodejs-tutorial

新建文件夹 hello

E:\>mkdir hello

E:\>cd hello

E:\hello>code .

E:\hello>node app.js

下载express

E:\hello>npm install -g express-generator
C:\Users\ASUS\AppData\Roaming\npm\express -> C:\Users\ASUS\AppData\Roaming\npm\node_modules\express-generator\bin\express-cli.js
+ express-generator@4.16.0
added 10 packages in 2.92s

在工程中建立文件夹

E:\hello>express myExpressApp

warning: the default view engine will not be jade in future releases
warning: use `--view=jade' or `--help' for additional options


create : myExpressApp\
create : myExpressApp\public\
create : myExpressApp\public\javascripts\
create : myExpressApp\public\images\
create : myExpressApp\public\stylesheets\
create : myExpressApp\public\stylesheets\style.css
create : myExpressApp\routes\
create : myExpressApp\routes\index.js
create : myExpressApp\routes\users.js
create : myExpressApp\views\
create : myExpressApp\views\error.jade
create : myExpressApp\views\index.jade
create : myExpressApp\views\layout.jade
create : myExpressApp\app.js
create : myExpressApp\package.json
create : myExpressApp\bin\
create : myExpressApp\bin\www

change directory:
> cd myExpressApp

install dependencies:
> npm install

run the app:
> SET DEBUG=myexpressapp:* & npm start

确保npm文件完整 再次安装npm


E:\hello>cd myExpressApp

E:\hello\myExpressApp>npm install
npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated constantinople@3.0.2: Please update to at least constantinople 3.1.1
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
npm WARN notice [SECURITY] constantinople has 1 critical vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=constantinople&version=3.0.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] uglify-js has 2 low vulnerabilities. Go here for more details: https://nodesecurity.io/advisories?search=uglify-js&version=2.2.5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm notice created a lockfile as package-lock.json. You should commit this file.
added 101 packages in 16.256s

开始工作

E:\hello\myExpressApp>npm start

> myexpressapp@0.0.0 start E:\hello\myExpressApp
> node ./bin/www

GET / 200 514.910 ms - 170
GET /stylesheets/style.css 200 3.236 ms - 111
GET /favicon.ico 404 15.538 ms - 1032
GET / 304 13.080 ms - -
GET /stylesheets/style.css 304 1.244 ms - -
GET / 304 9.966 ms - -
GET /stylesheets/style.css 304 1.572 ms - -

CTRL+C结束服务

终止批处理操作吗(Y/N)? y

E:\hello\myExpressApp>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值