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

day 3 #3

Open
N0ns opened this issue Oct 10, 2018 · 0 comments
Open

day 3 #3

N0ns opened this issue Oct 10, 2018 · 0 comments

Comments

@N0ns
Copy link
Owner

N0ns commented Oct 10, 2018

爬音乐

mysql

安装mysql模块

npm i mysql

闭包

项目知识点 面试知识点

//global 1
function country1(){ 2
	function city1(){ 3
	}
	function city2(){
	}
	return city1
}
var a = country1()

(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