# sky **Repository Path**: tan-yingjuan/sky ## Basic Information - **Project Name**: sky - **Description**: 全国空气质量分析与可视化 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-24 - **Last Updated**: 2024-05-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## web-mysql-server 前端数据库连接服务 ## 初始化 ``` 安装nodejs后在本目录下执行 npm run init //如果卡住了可以尝试安装cnpm后用cnpm替换npm ``` ## 修改index.js中的数据库配置和服务端口号 ``` //修改数据库配置为自己的 DB.config = { host: 'localhost', port:3306, user:'root', password: 'root', database: 'sky' } //默认端口8080 httpServer.listen(8080, '0.0.0.0', function () { console.log('HTTP Server is running'); }) ``` ### 启动服务 ``` npm run server ``` ### 静态文件 ``` 放在www文件夹,访问 http://localhost:8081 ``` ### 访问数据库接口 ``` url:http://localhost:8081/eval method:POST data:{ sql:'select * from user;' } ``` ### 文件上传接口 ``` url:http://localhost:8081/upload method:POST 文件字段关键字file ``` ### 文件访问接口 ``` url:http://localhost:8081/file/:filename method:GET ```