express配置session
# 参考文档

- [express+session实现简易身份认证](https://www.cnblogs.com/chyingp/p/express-session.html)
- [express-session官方文档](https://github.com/expressjs/session#options)
- [极客学院cookie 和 session](http://wiki.jikexueyuan.com/project/node-lessons/cookie-session.html)
- [Node.js + Express 登录拦截](https://www.jianshu.com/p/947db5ed1af7)
- [Vue+NodeJS的跨域请求如何保存session]

# token
- [基于express框架的Token实现方案](https://www.cnblogs.com/hlere/p/6668159.html?utm_source=itdadao&utm_medium=referral)
- [nodejs生成UID（唯一标识符）——node-uuid模块](https://www.cnblogs.com/yourstars/p/5995961.html)

# 跨域传cookies

很多浏览器默认是不传递cookies的，可以在前后端分别配置如下进行跨域传递
```js
$.ajax({
	type: "get",
	url: "//localhost:3000/fe/getFemaleList",
	crossDomain: true,
	xhrFields: {
		withCredentials: true//允许cookie传递
	},
	async: true,
	data: {
		mobile: self.mobile,
		vcode: self.vcode
	},
	success(data) {
		console.log(data)
	}
});
```
```js
app.use(function(req, res, next) {
	//res.append("Access-Control-Allow-Origin", "*");
	res.append("Access-Control-Allow-Origin", "http://localhost:12345");
	res.append("Access-Control-Allow-Credentials", true);// Allow Cookie
	//res.append("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
});
```