💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 安装node [expressjs框架官方](http://www.expressjs.com.cn/) [egg框架文档](https://eggjs.org/zh-cn/) [webpack中文文档](https://www.webpackjs.com/guides/getting-started/) node安装下载 <http://nodejs.cn/download/> - zip安装 ``` <pre class="calibre14">``` C<span class="token2">:</span>\www\nodejs 添加到环境变量 C<span class="token2">:</span>\app\nodejs\node<span class="token">-</span>global 加入环境变量 ``` ``` - 配置新建两个目录在node下面 ``` <pre class="calibre14">``` npm config set prefix <span class="token4">"C:\app\nodejs\node-global"</span> npm config set cache <span class="token4">"C:\app\nodejs\node-cache"</span> npm config set registry https<span class="token2">:</span><span class="token">/</span><span class="token">/</span>registry<span class="token2">.</span>npm<span class="token2">.</span>taobao<span class="token2">.</span>org ``` ``` - node命令 ``` <pre class="calibre14">``` node <span class="token">-</span>v npm <span class="token">-</span>v npm config list 查看配置 npm run serve 低版本用的是dev<span class="token2">,</span>本地运行 npm run build 打包 npm install <span class="token">-</span>g npm 升级npm自己 npm uninstall <span class="token">-</span>g xxx 卸载全局包 npm list 当前目录已安装插件 npm get registry 查看源 npm update –dave<span class="token">-</span>dev 更新全部插件 npm ls <span class="token">-</span>g <span class="token">--</span>depth <span class="token3">0</span> 查看全局模块 npm ls <span class="token">--</span>depth <span class="token3">0</span> 查看本地模块 rm <span class="token">-</span>rf node_modules<span class="token">/</span> 删除扩展重新安装 npm install npm config set registry http<span class="token2">:</span><span class="token">/</span><span class="token">/</span>registry<span class="token2">.</span>npmjs<span class="token2">.</span>org 切回官方npm ``` ``` - 安装模块 ``` <pre class="calibre14">``` npm install <span class="token">-</span>g cnpm <span class="token">--</span>registry<span class="token">=</span>https<span class="token2">:</span><span class="token">/</span><span class="token">/</span>registry<span class="token2">.</span>npm<span class="token2">.</span>taobao<span class="token2">.</span>org 安装cnpm npm install <span class="token">-</span>g less npm install <span class="token">-</span>g sass cnpm install <span class="token">-</span>g supervisor 热部署工具<span class="token2">,</span>supervisor <span class="token3">1.</span>js <span class="token6">//切换到程序目录执行</span> npm install <span class="token">-</span>g express cnpm install express <span class="token">--</span>save 安装到本地 npm install <span class="token">-</span>g express<span class="token">-</span>generator express <span class="token">--</span>version ``` ``` - 简单测试 ``` <pre class="calibre14">``` const express <span class="token">=</span> <span class="token1">require</span><span class="token2">(</span><span class="token4">'express'</span><span class="token2">)</span> const app <span class="token">=</span> <span class="token1">express</span><span class="token2">(</span><span class="token2">)</span> app<span class="token2">.</span><span class="token1">get</span><span class="token2">(</span><span class="token4">'/'</span><span class="token2">,</span> <span class="token2">(</span>req<span class="token2">,</span> res<span class="token2">)</span> <span class="token">=</span><span class="token">></span> res<span class="token2">.</span><span class="token1">send</span><span class="token2">(</span><span class="token4">'Hello World,测试!'</span><span class="token2">)</span><span class="token2">)</span> app<span class="token2">.</span><span class="token1">listen</span><span class="token2">(</span><span class="token3">3000</span><span class="token2">,</span> <span class="token2">(</span><span class="token2">)</span> <span class="token">=</span><span class="token">></span> console<span class="token2">.</span><span class="token1">log</span><span class="token2">(</span><span class="token4">'演示地址127.0.0.1:3000'</span><span class="token2">)</span><span class="token2">)</span> ``` ``` 安装mysql npm install -g mysql ``` <pre class="calibre14">``` var mysql <span class="token">=</span> <span class="token1">require</span><span class="token2">(</span><span class="token4">'mysql'</span><span class="token2">)</span> var connection <span class="token">=</span> mysql<span class="token2">.</span><span class="token1">createConnection</span><span class="token2">(</span><span class="token2">{</span> host <span class="token2">:</span> <span class="token4">'127.0.0.1'</span><span class="token2">,</span> user <span class="token2">:</span> <span class="token4">'root'</span><span class="token2">,</span> password <span class="token2">:</span> <span class="token4">'mysql'</span><span class="token2">,</span> database <span class="token2">:</span> <span class="token4">'tp6'</span> <span class="token2">}</span><span class="token2">)</span><span class="token2">;</span> connection<span class="token2">.</span><span class="token1">connect</span><span class="token2">(</span><span class="token2">)</span> connection<span class="token2">.</span><span class="token1">query</span><span class="token2">(</span><span class="token4">'SELECT 1 + 1 AS solution'</span><span class="token2">,</span> <span class="token5">function</span> <span class="token2">(</span>err<span class="token2">,</span> rows<span class="token2">,</span> fields<span class="token2">)</span> <span class="token2">{</span> <span class="token5">if</span> <span class="token2">(</span>err<span class="token2">)</span> <span class="token5">throw</span> err console<span class="token2">.</span><span class="token1">log</span><span class="token2">(</span><span class="token4">'The solution is: '</span><span class="token2">,</span> rows<span class="token2">[</span><span class="token3">0</span><span class="token2">]</span><span class="token2">.</span>solution<span class="token2">)</span> <span class="token2">}</span><span class="token2">)</span> connection<span class="token2">.</span><span class="token1">end</span><span class="token2">(</span><span class="token2">)</span> ``` ``` python 2.7 ``` <pre class="calibre16">``` npm config set python <span class="token4">"C:\app\py27\python.exe"</span> ``` ```