当前位置: 首页 > news >正文

如何通过查询网站注册时间网站怎么修改模板内容

如何通过查询网站注册时间,网站怎么修改模板内容,福州模板建站哪家好,手机网站建设制作公司静态服务中间件#xff1a;koa-static 中间件可以决定是否向下执行#xff0c;如果自己可以处理#xff0c;那么直接处理完毕结束#xff0c;如果自己处理不了#xff0c;next 方法会继续向下执行 新建 public 文件夹#xff0c;里面添加 index.html、style.css 文件 …静态服务中间件koa-static 中间件可以决定是否向下执行如果自己可以处理那么直接处理完毕结束如果自己处理不了next 方法会继续向下执行 新建 public 文件夹里面添加 index.html、style.css 文件 !DOCTYPE html html langenheadmeta charsetUTF-8 /meta nameviewport contentwidthdevice-width, initial-scale1.0 /title凯小默测试静态服务中间件koa-static/titlelink relstylesheet href./style.css //headbodyh1凯小默测试静态服务中间件koa-static/h1/body /htmlbody {background-color: pink; }koa-static npm i koa koa-static用法 const serve require(koa-static); const Koa require(koa); const app new Koa();// $ GET /package.json app.use(serve(.));// $ GET /hello.txt app.use(serve(test/fixtures));// or use absolute paths app.use(serve(__dirname /test/fixtures));app.listen(3000);console.log(listening on port 3000);业务代码 static.js 中使用 koa-static const Koa require(koa); const path require(path); const bodyParser require(koa-bodyparser); // 使用自己实现的中间件 // const static require(koa-static); const static require(./kaimo-koa-static); const app new Koa(); app.use(bodyParser()); app.use(static(__dirname)); app.use(static(path.resolve(__dirname, public)));app.use((ctx, next) {console.log(ctx.path, ctx.method);if (ctx.path /login ctx.method GET) {ctx.body form action/login methodpost用户名input typetext nameusername/br/密码input typepassword namepassword/br/button提交/button/form;} else {return next();} });app.use(async (ctx, next) {console.log(ctx.path, ctx.method);if (ctx.path /login ctx.method POST) {ctx.body ctx.request.body;} else {await next();} });app.on(error, function (err) {console.log(error-----, err); });app.listen(3000);启动服务访问 http://localhost:3000/index.html nodemon static.js下面实现自己的 koa-static需要安装 mime const path require(path); const fs require(fs).promises; const mime require(mime);console.log(使用的是 kaimo-koa-static 中间件); module.exports function static(root) {return async (ctx, next) {let filePath path.join(root, ctx.path);try {let statObj await fs.stat(filePath);// 判断是否是文件if (statObj.isFile()) {ctx.type mime.getType(filePath) ;charsetutf-8;ctx.body await fs.readFile(filePath);} else {await next();}} catch (e) {await next();}}; };
http://www.dnsts.com.cn/news/48369.html

相关文章:

  • 网站相册优化丰台石家庄网站建设
  • 做购物平台网站客户体验活动ui界面设计实例100例
  • 嘉兴网站制作彩票引流推广方法
  • 天津企悦在线网站建设建设银行青海省分行门户网站
  • 公司的网站建设公司网站建设今天上海新闻
  • 高端企业网站建设注意问题北京网站建设北京
  • 宁波公司建设网站摄影师常用的网站
  • 国外产品展示网站模板chrome 谷歌浏览器
  • 域名解析站长工具设计logo的手机软件免费
  • 大连建设工程招聘信息网站大数据营销分析
  • 网页设计和网站开发哪个好网站建设与管理策划书
  • 汽车网站 源码app的制作过程
  • 南通市规划建设局网站网页界面设计原则
  • 山东网站建设工作室wordpress 主题数据
  • 网站建设中颜色的感染力梧州网站开发
  • 给个网站你们知道的广州建设局网站
  • 网站怎么优化搜索域名抢注网站源码
  • 南昌网站建站怎样做网站挣钱
  • 正规品牌网站设计图片网站建设合同按什么交印花税
  • 南川网站建设辅助网站怎么做
  • 下什么软件做网站工信部网站备案怎么查
  • 做网站汉狮网络网站装修的代码怎么做
  • 网站对齐原则怎么看一个网站用什么语言做的
  • 取消网站备案流程wordpress 上传权限
  • 学校网站moodle ual wordpress
  • 上海 .net网站建设做的最好的视频教学网站
  • 陕西做网站的公司在哪阿里云官网
  • 建设一个网站的规划手机电子商务网站建设策划书
  • 做网站思路前端的网站重构怎么做
  • 网站关键词做排名不分wordpress实现自动重定向