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

添加 API 文档 #56

Merged
merged 2 commits into from
Apr 14, 2016
Merged

添加 API 文档 #56

merged 2 commits into from
Apr 14, 2016

Conversation

jysperm
Copy link
Contributor

@jysperm jysperm commented Apr 8, 2016

依赖于 #45

经过刚刚和陈伟的讨论,Node SDK 不适合像 JavaScript SDK 一样从注释生成 API 文档,因为 Node SDK 提供的功能比较琐碎,提供的组件类型比较杂,所以初步打算用 Markdown 手工编写 API 文档。

在内容上主要介绍参数格式、一部分内部细节,大段描述性文字链接到官网文档。

我大体上打算使用 https://github.com/atom/atomdoc 的语法,这是一个基于 Markdown 的 JavaScript API 描述语言,可以被解析并生成 HTML 文件。

@jysperm jysperm changed the title [WIP] 添加 API 文档 添加 API 文档 Apr 11, 2016
* `secret: string`:对 Cookie 进行签名的密钥,请选用一个随机字符串。
* `name?: string`:Cookie 名称,默认为 `avos.sess`。
* `maxAge?: number`:Cookie 过期时间。
* `fetchUser?: boolean`:是否自动查询用户信息,默认为 `false`,即不自动查询,这种情况下只能访问用户的 `id` 和 `sessionToken`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像 id 都没办法访问

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以的呀,这是 fetchUser 为 false 的代码:

    var user = new AV.User();
    user.id = uid;
    user._sessionToken = sessionToken;
    return cb(null, user);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id 貌似是从 cookie 中记录的。
我当初还纠结过如果这个 id 和 sessionToken 不匹配怎么办?
所以我建议对外就只承诺 sessionToken 存在,甚至都不承诺有效(比如用户修改密码了)。
无效没关心,因为后面的操作会因为 acl 而校验 sessionToken 。

@sdjcw
Copy link
Contributor

sdjcw commented Apr 12, 2016

我没问题了。

@jysperm jysperm merged commit a0ca82f into leancloud:master Apr 14, 2016
@jysperm jysperm removed the review label Apr 14, 2016
@jysperm jysperm deleted the api-document branch April 14, 2016 06:27
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

Successfully merging this pull request may close these issues.

2 participants