nodejs express project

本文介绍如何使用Express.js框架快速搭建一个Web应用项目,包括安装Express.js及其生成器、创建项目、安装依赖等步骤,并展示了启动项目的命令及浏览器访问示例。
user root
  1. install express
    npm install express -g

  2. install express...
    npm install express-generator -g

  3. Create express project
    express <project_name>

  4. Enter project files and install dependency
    cd <project_name>
    npm install
    Maybe the dependency is not all round. So you need install the others yourself.
    But if there is a warning as
    npm WARN deprecated jade@0.26.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
    Just ignore it.

  5. start peoject
    express start

  6. done
    terminal viewer:
\> myweb@0.0.0 start /home/pualus/Documents/web/node/myweb
\> node ./bin/www
GET / 200 315.817 ms - 170
GET /stylesheets/style.css 200 6.160 ms - 111
GET /favicon.ico 404 35.503 ms - 1185
GET /favicon.ico 404 34.215 ms - 1185

Open the firefox then input site:localhost:3000/
OK!!!

转载于:https://www.cnblogs.com/pualus/p/6859886.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值