Skip to content

Commit 175d8c1

Browse files
committed
Added avosExpressCookieSession and avosExpressHttpsRedirect api docs
1 parent a8acf85 commit 175d8c1

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

lib/cloud.js

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
(function() {
1+
/**
2+
* Cloud code only APIs.
3+
* All of these APIs are not implemented in client sdk,
4+
* we put them here to generate API docs.
5+
*/
6+
(function(root) {
7+
root.AV = root.AV || {};
8+
/**
9+
* Contains all AV API classes and functions.
10+
* @name AV
11+
* @namespace
12+
*
13+
* Contains all AV API classes and functions.
14+
*/
15+
var AV = root.AV;
16+
217
/*
318
* @class A Request object that is passed into the afterDelete function.
419
* <strong>Available in Cloud Code only.</strong>
@@ -214,4 +229,33 @@
214229
* @return {AV.Promise} A promise that will be resolved with a AV.Cloud.HTTPResponse object when the request completes.
215230
*/
216231
AV.Cloud.httpRequest = function(options) {};
217-
})()
232+
233+
/**
234+
* @namespace
235+
* Express middleware for AV.User session management through a signed browser cookie.
236+
* This API is LeanCloud-specific, and not included in the original Express API.
237+
* See <a href="https://leancloud.cn/docs/cloud_code_guide.html#处理用户登录和登出">Cloud Code Guide</a> for details.
238+
* <br/><strong>Available in Cloud Code only</strong>.
239+
* @param {String} options.cookie Optional.
240+
* Standard cookie options for the LeanCloud user session cookie.
241+
* For your application's security, we ignore the httpOnly, signed flags in cookie options,
242+
* and always set these to true for the cookie generated by this middleware.
243+
* @param {Boolean} options.fetchUser Optional,Default: false.
244+
* Whether to fetch the full current LeanCloud user object on each request.
245+
* Setting this to true results in one extra LeanCloud API request during each Express request. If you set this false,
246+
* ACLs will still work when you query for objects the current user is allowed to see,
247+
* but you cannot access any fields on the current user object (except id) until you manually call AV.User.current().fetch().
248+
* @param {String} options.key Optional, Default: 'avos.sess'
249+
* Cookie name for storing the LeanCloud user session.
250+
*/
251+
avosExpressCookieSession = function(options) { };
252+
253+
/**
254+
* @namespace
255+
* Express middleware for redirecting the user to the HTTPS endpoint with the same URL.
256+
* This API is LeanCloud-specific, and not included in the original Express API.
257+
* See <a href="https://leancloud.cn/docs/cloud_code_guide.html#启用https">Cloud Code Guide</a> for details.
258+
*/
259+
avosExpressHttpsRedirect = function() {};
260+
261+
})(this)

0 commit comments

Comments
 (0)