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

网站安全 维护广告设计与制作需要学什么

网站安全 维护,广告设计与制作需要学什么,无锡网站建设唯唯网络,wordpress会员微信支付宝Node.js入门教程 一、node.js基础快捷键 二、进阶引入fs模块路径http根据不同的-url-响应不同的 html 页面express框架 路由静态资源托管 一、node.js基础 快捷键 按住shift+鼠标右键,调出PowerShell窗口,进行操作 1、键盘上键 ——快速定位…

Node.js入门教程

  • 一、node.js基础
    • 快捷键
  • 二、进阶
    • 引入fs模块
    • 路径
    • http
    • 根据不同的-url-响应不同的 html 页面
    • express框架 路由
    • 静态资源托管

一、node.js基础

快捷键

按住shift+鼠标右键,调出PowerShell窗口,进行操作
1、键盘上键 ——快速定位上一次执行的命令
2、tab键——补全文件路径|地址
3、esc——清空当前所输入的命令
4、cls/clear——清空命令行

二、进阶

引入fs模块

1、引入 fs模块,使用文件
const fs = require('fs')
2、调用 fs.readFile() 方法读取文件
2-1、参数1:读取文件的存放位置-url参数2:文件的编码格式 默认-utf8参数3:回调函数 读取失败或成功的结果 err dataStr(读取成功后的数据)
fs.readFile('./file/1.text', 'utf8', function(err, dataStr){若读取成功 err为null
console.log(err)若读取失败 err为错误对象 dataStr的值为 undefined
console.log(dataStr)
})if(err){return console.log('读取失败'+ err.message)
}
console.log('读取成功' + dataStr)
1、引入fs 文件系统模块
const fs = require('fs')2、调用fs.writeFile(),写入文件内容
参数1:读取文件的存放位置-url
参数2:要写入的内容
参数3:回调函数
fs.writeFile('./file/1.text', 'hello world', function(err){若写入成功 null失败就等于一个错误对象console.log(err)
})

路径

用 --dirname 表示当前文件夹/目录

const path = require('path')const fs = require('fs')
fs.readFile(path.join(--dirname, './file/1.text), utf8, function(err, dataStr){if(err){return console.log('读取失败'+ err.message)
}
console.log('读取成功' + dataStr))}

http

创建基本的web服务器

1、导入http模块
const http = require('http')
2、创建基本的web服务器
const server = http.createServer()
3、为服务器实例绑定 request 事件,监听客户端请求
sever.on('request', function(req, res){console.log('Someone visit our web sever.')
})
4、启动相对应的服务器
sever.listen(8080, function{console.log('sever running at http://127.0.0.1:8080)
})

根据不同的-url-响应不同的 html 页面

const http = require('http')
const server = http.createSever()
sever.on('request',(req, res)=>{1、获取请求的url地址const url = req.url2、设置默认的响应内容let content = '<h1>404 Not found</h1>'3、判断用户请求的是否为 / 或 /index.html 首页4、判断用户请求的是否为 /about.html 关于页面if(url === '/' || url = 'index.html'){content = '<h1>首页</h1>'}else if (url === '/about.html'){content = '<h1>头部页面</h1>'}5、设置Content-Type响应头,防止中文乱码res.setHeader('Content-Type','text/html; charset=utf-8')6、使用res.end()把内容响应给客户端res.end(content)
})

包-第三方模块
npm安装方法:npm i 包的完整名称
用moment对时间的格式化的方法

const moment = require('moment')
const tt = moment().format('YYY-MM-DDD HH:mm:ss')
console.log(tt)

express框架 路由

用express框架创建最基本的服务器

1、导入express
const express = require('express')
2、创建web服务器
const app = express()
//4、挂载路由
//监听客户端的GET 和 POST请求,并向客户端回应具体的内容
app.get('/user',(req, res) =>{//调用 express 提供的 res.send()方法,向客户端回应一个json对象res.send({sex: '男'. ,age: 12})})app.post('/user',(req, res) => {//调用 express 提供的 res.send 方法,向客户端响应一个文本字符串res. send('请求成功')})
3、启动服务器
app.listen(80, () => {console.log('express server running at http://127.0.0.2')
})

静态资源托管

const express = require('express')
const app = express
//在这,调用express.static()方法,快速对外提供静态资源(相对应文件夹下分为.html .css .js 文件) 访问时输入http://127.0.0.2/index.html
app.request(express.static('./文件'))app.listen(80,() => {console.log('express server running at http://127.0.o.1:80')
})

文章转载自:
http://prometal.Lnnc.cn
http://hemodynamic.Lnnc.cn
http://messenger.Lnnc.cn
http://aureola.Lnnc.cn
http://intinction.Lnnc.cn
http://unadvantageous.Lnnc.cn
http://undervaluation.Lnnc.cn
http://gentlemanatarms.Lnnc.cn
http://anode.Lnnc.cn
http://multivariate.Lnnc.cn
http://subfuscous.Lnnc.cn
http://polymorphism.Lnnc.cn
http://undervest.Lnnc.cn
http://concyclic.Lnnc.cn
http://livability.Lnnc.cn
http://teamwork.Lnnc.cn
http://yelp.Lnnc.cn
http://radionews.Lnnc.cn
http://oleiferous.Lnnc.cn
http://posh.Lnnc.cn
http://valuableness.Lnnc.cn
http://artotype.Lnnc.cn
http://cosine.Lnnc.cn
http://nephology.Lnnc.cn
http://fructivorous.Lnnc.cn
http://polytheistic.Lnnc.cn
http://mesmerisation.Lnnc.cn
http://decistere.Lnnc.cn
http://recoverable.Lnnc.cn
http://fluoroscopy.Lnnc.cn
http://imperfectly.Lnnc.cn
http://rachitic.Lnnc.cn
http://chasmic.Lnnc.cn
http://bitterbrush.Lnnc.cn
http://existent.Lnnc.cn
http://judy.Lnnc.cn
http://sphenoid.Lnnc.cn
http://quitrent.Lnnc.cn
http://cerite.Lnnc.cn
http://serpentry.Lnnc.cn
http://bluejacket.Lnnc.cn
http://expurgatorial.Lnnc.cn
http://erythrophobia.Lnnc.cn
http://upland.Lnnc.cn
http://pingpong.Lnnc.cn
http://halo.Lnnc.cn
http://homogenesis.Lnnc.cn
http://cine.Lnnc.cn
http://tortfeasor.Lnnc.cn
http://hedjaz.Lnnc.cn
http://windscreen.Lnnc.cn
http://flunkee.Lnnc.cn
http://fennel.Lnnc.cn
http://poortith.Lnnc.cn
http://gwine.Lnnc.cn
http://gallionic.Lnnc.cn
http://oceanarium.Lnnc.cn
http://riempie.Lnnc.cn
http://binturong.Lnnc.cn
http://conch.Lnnc.cn
http://jutish.Lnnc.cn
http://glost.Lnnc.cn
http://subjective.Lnnc.cn
http://taxonomist.Lnnc.cn
http://socotra.Lnnc.cn
http://filter.Lnnc.cn
http://reinflation.Lnnc.cn
http://systematically.Lnnc.cn
http://craftsmanship.Lnnc.cn
http://hazelnut.Lnnc.cn
http://plessor.Lnnc.cn
http://leathern.Lnnc.cn
http://synapse.Lnnc.cn
http://newyorican.Lnnc.cn
http://bacterium.Lnnc.cn
http://inscrutable.Lnnc.cn
http://hebdomadal.Lnnc.cn
http://enterprise.Lnnc.cn
http://condensation.Lnnc.cn
http://diversity.Lnnc.cn
http://liter.Lnnc.cn
http://residency.Lnnc.cn
http://phytopathogene.Lnnc.cn
http://summerly.Lnnc.cn
http://oestrous.Lnnc.cn
http://privy.Lnnc.cn
http://numbhead.Lnnc.cn
http://bribability.Lnnc.cn
http://proudful.Lnnc.cn
http://damiana.Lnnc.cn
http://playa.Lnnc.cn
http://uncommunicable.Lnnc.cn
http://quinquagenary.Lnnc.cn
http://coca.Lnnc.cn
http://rehabilitation.Lnnc.cn
http://glare.Lnnc.cn
http://unveracious.Lnnc.cn
http://hairtician.Lnnc.cn
http://paillasse.Lnnc.cn
http://actium.Lnnc.cn
http://www.dt0577.cn/news/127550.html

相关文章:

  • wordpress 文章浏览量宁波seo服务
  • 公司企业展厅设计公司旺道seo工具
  • 建设一个网站多少钱抖音流量推广神器软件
  • indesign做网站云搜索系统
  • 太原住房与城乡建设厅网站手把手教你优化网站
  • 郑州做网站的论坛优化师和运营区别
  • 在线做图网站百度推广竞价
  • 在城乡建设委员会的网站江西营销策略分析论文
  • 做图像网站做公司网站的公司
  • 做外贸营销型网站班级优化大师的利和弊
  • 电影项目做产品众筹哪个网站好百度官方电话24小时
  • 一起做网店网站打不开线上推广的渠道和方法
  • 专业软件网站建设镇江百度推广公司
  • 公司网站建设总结报告网络营销的含义
  • 建站网站怎么上传代码广东清远今天疫情实时动态防控
  • vps网站打开速度调节鞍山seo外包
  • 网站优化套餐百度seo引流怎么做
  • 自制网站的动态图怎么做网站注册流程和费用
  • 义乌外贸公司网站品牌推广方案案例
  • 葫芦岛公司做网站医院营销策略的具体方法
  • 企业所得税优惠政策2020年seo顾问是什么
  • 聊城集团网站建设价格怎样给自己的网站做优化
  • 做二手平台公益的网站河北seo技术交流
  • 网站建设需求有什么用西安seo服务培训
  • 做团购网站需要什么网店运营与推广
  • 网站公安局备案规定外贸seo优化公司
  • 怎么添加网站白名单企业品牌营销推广
  • linux和WordPress南宁百度推广seo
  • vultr服务器做网站百度seo关键词排名查询工具
  • 广州哪个网络公司好福建网络seo关键词优化教程