Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

爬音乐 #3

Open
yangkaiyangyi opened this issue Oct 9, 2018 · 0 comments
Open

爬音乐 #3

yangkaiyangyi opened this issue Oct 9, 2018 · 0 comments

Comments

@yangkaiyangyi
Copy link
Owner

yangkaiyangyi commented Oct 9, 2018

爬音乐

mysql

安装mysql模块

npm i mysql

闭包 :函数套函数-在实际工作中用处不多

(function(){})()一般会在实际工作中能用到,

express

express jq bootstrap
框架 框架
后端 前端 前端
js js css

(图纸,方位,风水,地质,大小,范围,层高,木结构MVC,MVVM)
框架(架构师)

(斧子,锤子,工具,钻)
库(前端工程师)(jQ封装了方法)

npm i express

路由:找资源文件的路径

var express = require('express')
var app = express()
//路由
app.get('/', function (req, res) {
  res.send('Hello World')
})
app.get('/list', function (req, res) {
  res.send('进入index路由')
})
app.get('/detail', function (req, res) {
  res.send('进入home路由')
})
app.listen(3000)

处理get请求,获取参数只需要req.query

app.get()

处理post请求,相对get请求会麻烦点,需要body-parser配合req.body

var bodyParser = require('body-parser');
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
 
// parse application/json
app.use(bodyParser.json())
app.post()
php nodejs(express)
$_GET["xxxx"] req.query
$_POST["xxxx"] req.body
header req.append
echo res.send
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant