<!DOCTYPEhtml><html><head> <title>小鹿线后台管理系统</title> <linkrel="stylesheet"href="/stylesheets/bootstrap.min.css"/> <linkrel=stylesheethref=/stylesheets/common.css/> <style> .container{ width:100vw; height:100vh;
mysql2
express操作数据库constexpress=require(express)constapp=express()constmysql2=require(mysql2)app.get(/,async(req,res)=>{ constconfig=mysqlConfig() constpromisePool=mysql2.createPool(config).promise() varusers=awaitpromisePool.query(`select*fromstudent`)
node用multer上传图片
1.引入multerconstmulter=require(multer)2.进行配置conststorage=multer.diskStorage({//图片存放的路径 destination:(req,file,cb)=>{ cb(null,./file/image) }, //存储的文件名 filename:(req,file,cb)=>{ //正则替换,拿到图片的类型 lettype=file.originalname.replace(/.+\./,.
ejs
<%%>流程控制标签(写的是ifelse,for)<%=%>输出标签(原文输出HTML标签)<%-%>输出标签(HTML会被浏览器解析)<%#%>注释标签<%-include("user/show,{user∶user})%>导入公共的模板内容express使用和配置ejs模块//配置模板引擎app.set("views","./views")app.set("viewengine","ejs")koa使用和配置ejs模块constKoa=require(koa)constviews=re
cors跨域代理**后续
cnpmicorsvarcors=require(cors)router.use(cors())express允许跨域router.all(*,function(req,res,next){ res.header(Access-Control-Allow-Origin,*); //Access-Control-Allow-Headers,可根据浏览器的F12查看,把对应的粘贴在这里就行 res.header(Access-Control-Allow-Headers,Content-Type); res.header(Acc
nodejs的图片上传
<divclass="dialogisDialog"></div><divclass="dialog-wrapisDialog"> <divclass="dialog-header"> <h3>添加banner图</h3> <divclass="close"> <imgsrc="/images/icon_guanbi.png"alt=""> </div> </div> <formaction="/add