一、nodejs
1、简单的说 Node.js 是js的服务器。Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台。 Node.js是一个事件驱动I/O服务端JavaScript环境,基于Google的V8引擎,V8引擎执行Javascript的速度非常快,性能非常好。
2、NodeJS安装
下载对应你系统的Node.js版本:https://nodejs.org/en/download/
3、示例hello word
var http = require('http');
var test2 = require('./test2');
http.createServer(function (request, response) {
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// 发送响应数据 "Hello World"
response.end('Hello World\n');
test2.hello2();
}).listen(8084);
// 终端打印如下信息
console.log('Server running at http://127.0.0.1:8084/');
二、express
安装express
npm install express --save -g
npm install express-generator --save -g
创建helloword.js文件
var express = require('express');
// 创建快速应用程序实例
var app = express();
// 快速路线 (GET,POST等)
app.get('/', function (req, res) {
res.send('Hello World');
})
// 启动服务器
var server = app.listen(8081, function () {
var host = server.address().address
var port = server.address().port
console.log("应用实例,访问地址为 http://%s:%s", host, port)
})
启动服务:node helloword.js
安装react脚手架
npm install -g create-react-app
三、vue脚手架搭建项目
安装node.js + 搭建vue环境 + 安装脚手架 + 构建vue项目的详细教程_晴天'的博客-优快云博客_nodejs vue
1、安装vue,vue-cli(脚手架)
sudo npm install vue -g
sudo npm install vue-cli -g
sudo npm install webpack-dev-server -g
2、创建vue项目
在终端执行命令:vue init webpack test,npm install --ignore-scripts安装依赖包,cd进入 test 项目中,执行命令 npm run dev --legacy-peer-deps ,浏览器访问:localhost:8080
3、发布
vue 项目npm run build 进行打包部署,项目中会多出一个dist文件,将dist文件复制到创建好的node express服务器项目中的expressDemo/public目录下,浏览器访问localhost:3000/dist
项目实例:
1、ruoyi部署
cd ruoyi-ui
npm install --registry=https://registry.npm.taobao.org
export NODE_OPTIONS=--openssl-legacy-provider
npm run dev
启动RuoYiApplication.java
打开浏览器,输入:http://localhost:80 (默认账户 admin/admin123)
2、davince部署
cd webapp
npm install
npm run build
将build目录下的文件拷贝出来,并在根目录下新建davici-ui目录,放入其中。
运行springboot
打开浏览器,输入:http://localhost:8080/ (默认账户 admin/admin123)
Vue项目开发介绍_vue开发_GG_Bonin的博客-优快云博客
3、datart
git地址:https://gitee.com/yydoghouse/mydatart.git
1)启动后端(不要compile)
修改service/application.yarn,添加mysql数据源配置
运行DatartServerApplication
2)启动前端
npm install --registry=https://registry.npm.taobao.org
npm install --registry=https://registry.npmmirror.com
export NODE_OPTIONS=--openssl-legacy-provider
npm run build
npm start
datart添加数据探查菜单
1)添加“数据探查”字目:修改locales.zh.translation.json文件
2)左菜单添加tab:修改MainPage/Navbar/index.tsx文件
修改MainPage/pages/PermissionPage/constants.ts
3)添加数据探查页面:MainPage/pages中克隆一个SourcePage->QueryPage
MainPage/index.tsx引入querypage
4)修改菜单跳转地址(查询数据源):修改QueryPage/slice/thunks.ts
注:useEffect(effect:()=>{})组件渲染回调函数