NodeJs-- 新建项目实例
- 安装Nodejs: 下载地址:http://nodejs.org/download/
- 设置环境变量,例如我将nodejs装在D:/program文件夹下,则设以下为系统环境变量
[html]view plaincopyprint?
- D:\Program\nodejs
- 安装Express开发框架:
[html]view plaincopyprint?
- //命令行输入命令
- npm install -g express
- npm install -g express-generator
- 新建项目
[html]view plaincopyprint?
- //命令行输入命令
- express -t ejs newsproject
- 按照提示进入项目目录,运行npm安装
[html]view plaincopyprint?
- //进入项目目录
- cd newsproject
- //输入命令安装
- npm install
- 运行项目
[html]view plaincopyprint?
- //项目目录下运行命令
- node app.js
- 浏览器访问:http://127.0.0.1:3000/即可见nodejs站点页面,页面输出:Express
- 上一篇 »php使用smarty实例
- 下一篇 »vscode 新建 springboot java项目