mirror of https://gitee.com/bigwinds/arangodb
commit
4712daa3cb
|
@ -34,7 +34,7 @@ var PersonModel = Foxx.Model.extend({
|
|||
}
|
||||
});
|
||||
|
||||
exports.model = TodoModel;
|
||||
exports.model = PersonModel;
|
||||
```
|
||||
|
||||
This has two effects: On the one hand it provides documentation. If you annotated
|
||||
|
|
|
@ -78,7 +78,7 @@ like any other collection with the db object, e.g.
|
|||
```
|
||||
|
||||
Of course you still use any collection directly with the db object even
|
||||
from Foxx. To access an collection called "movies" this could be one solution:
|
||||
from Foxx. To access a collection called "movies" this could be one solution:
|
||||
|
||||
```js
|
||||
app.get("/all", function(req, res) {
|
||||
|
@ -95,7 +95,7 @@ Then there are Foxx repositories. These are objects that you can create
|
|||
to hide the internals of the database access from the application so
|
||||
that the application will just use the repository but not the database.
|
||||
|
||||
A repository is an object that wrap access to a collection (or multiple
|
||||
A repository is an object that wraps access to a collection (or multiple
|
||||
collections if you want), whereas controller.collection returns the
|
||||
collection itself. That's the main difference.
|
||||
|
||||
|
@ -103,9 +103,9 @@ To return a list of users from a controller using a repository, you
|
|||
could use it like this:
|
||||
|
||||
```js
|
||||
var foxx = require("org/arangodb/foxx");
|
||||
var Foxx = require("org/arangodb/foxx");
|
||||
var db = require("org/arangodb").db;
|
||||
var usersRepo = new foxx.Repository(db._collection("users"));
|
||||
var usersRepo = new Foxx.Repository(db._collection("users"));
|
||||
app.get("/all", function(req, res) {
|
||||
res.json({ users: usersRepo.collection.toArray() });
|
||||
});
|
||||
|
|
|
@ -170,6 +170,8 @@ apps available on Github. You can install them via Foxx manager (covered in the
|
|||
chapter on Foxx manager) or simply clone them from [github](https://github.com/arangodb/).
|
||||
|
||||
Start with ["hello-foxx"](https://github.com/arangodb/hello-foxx) as it contains
|
||||
several basic usage examples. "aye-aye" and "fugu" are more advanced apps showing how
|
||||
to use Backbone, Underscore and Jquery together with Foxx. "foxx-authentication" shows
|
||||
how to register users, log in and check permissions.
|
||||
several basic usage examples. ["aye-aye"](https://github.com/arangodb/aye-aye)
|
||||
and ["fugu"](https://github.com/arangodb/aye-aye) are more advanced apps showing how
|
||||
to use Backbone, Underscore and Jquery together with Foxx. ["foxx-authentication"](https://github.com/arangodb/foxx-authentication)
|
||||
shows how to register users, log in and check permissions.
|
||||
|
||||
|
|
|
@ -492,7 +492,7 @@ extend(Controller.prototype, {
|
|||
///
|
||||
/// `FoxxController#activateAuthentication(opts)`
|
||||
///
|
||||
/// To activate authentication for this authentication, first call this function.
|
||||
/// To activate authentication for this controller, first call this function.
|
||||
/// Provide the following arguments:
|
||||
///
|
||||
/// * *type*: Currently we only support *cookie*, but this will change in the future
|
||||
|
@ -605,7 +605,7 @@ extend(Controller.prototype, {
|
|||
/// `FoxxController#register(path, opts)`
|
||||
///
|
||||
/// This works pretty similar to the logout function and adds a path to your
|
||||
/// app for the register functionality. You can customize it with a custom `*nSuccess*
|
||||
/// app for the register functionality. You can customize it with a custom *onSuccess*
|
||||
/// and *onError* function:
|
||||
///
|
||||
/// * *onSuccess* is a function that you can define to do something if the registration was
|
||||
|
|
|
@ -228,7 +228,7 @@ extend(RequestContext.prototype, {
|
|||
/// ```js
|
||||
/// app.get("/foxx/:id", function {
|
||||
/// // Do something
|
||||
/// }).pathParam("id", type: joi.number().integer().required().description("Id of the Foxx"));
|
||||
/// }).pathParam("id", joi.number().integer().required().description("Id of the Foxx"));
|
||||
/// ```
|
||||
///
|
||||
/// You can also pass in a configuration object instead:
|
||||
|
@ -587,7 +587,7 @@ extend(RequestContext.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @startDocuBlock JSF_foxx_RequestContext_onlyIfAuthenticated
|
||||
///
|
||||
/// `FoxxController#onlyIf(code, reason)`
|
||||
/// `FoxxController#onlyIfAuthenticated(code, reason)`
|
||||
///
|
||||
/// Please activate sessions for this app if you want to use this function.
|
||||
/// Or activate authentication (deprecated).
|
||||
|
|
Loading…
Reference in New Issue