mirror of https://gitee.com/bigwinds/arangodb
updated documentation
This commit is contained in:
parent
717851ddfe
commit
e6acd403ac
|
@ -1,6 +0,0 @@
|
|||
> ./arangod --server.endpoint tcp://127.0.0.1:8529 --server.endpoint ssl://127.0.0.1:8530 -server.keyfile server.pem /tmp/vocbase
|
||||
2012-07-26T07:07:47Z [8161] INFO using SSL protocol version 'TLSv1'
|
||||
2012-07-26T07:07:48Z [8161] INFO using endpoint 'ssl://127.0.0.1:8530' for http ssl requests
|
||||
2012-07-26T07:07:48Z [8161] INFO using endpoint 'tcp://127.0.0.1:8529' for http tcp requests
|
||||
2012-07-26T07:07:49Z [8161] INFO ArangoDB (version 1.1.alpha) is ready for business
|
||||
2012-07-26T07:07:49Z [8161] INFO Have Fun!
|
|
@ -87,8 +87,8 @@ WIKI = \
|
|||
DbaManualEmergencyConsole \
|
||||
ExtendingAql \
|
||||
FirstStepsArangoDB \
|
||||
Graphs \
|
||||
Glossary \
|
||||
Graphs \
|
||||
HandlingCollections \
|
||||
HandlingDocuments \
|
||||
HandlingEdges \
|
||||
|
@ -112,7 +112,7 @@ WIKI = \
|
|||
ImpManual \
|
||||
ImpManualBasics \
|
||||
ImplementorManual \
|
||||
ImplementorManualArangoErrors \
|
||||
ImplementorManualArangoErrors \
|
||||
IndexBitArray \
|
||||
IndexCap \
|
||||
IndexCapHttp \
|
||||
|
@ -149,8 +149,9 @@ WIKI = \
|
|||
UserManual \
|
||||
UserManualActions \
|
||||
UserManualArangosh \
|
||||
UserManualWebInterface \
|
||||
UserManualFoxx \
|
||||
UserManualFoxxManager \
|
||||
UserManualWebInterface \
|
||||
jsUnity
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
|
|
|
@ -2,8 +2,8 @@ Collection {#GlossaryCollection}
|
|||
================================
|
||||
|
||||
@GE{Collection}: A collection consists of documents. It is uniquely identified
|
||||
by the server via its collection identifier. It also has a unique name that
|
||||
clients should use to identify and access it.
|
||||
Collections have a type that is specified by the user when the collection is
|
||||
created. There currently are _document_ and _edge_ collections.
|
||||
The default type is _document_.
|
||||
by its collection identifier. It also has a unique name that clients should use
|
||||
to identify and access it. Collections can be renamed. is will change the
|
||||
collection name, but not the collection identifier. Collections have a _type_
|
||||
that is specified by the user when the collection is created. There are
|
||||
currently two types: _document_ and _edge_. The default type is _document_.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
The Arango Shell {#UserManualArangosh}
|
||||
======================================
|
||||
The ArangoDB Shell {#UserManualArangosh}
|
||||
========================================
|
||||
|
||||
@NAVIGATE_UserManualArangosh
|
||||
@EMBEDTOC{UserManualArangoshTOC}
|
||||
|
||||
Arango Shell Output {#UserManualArangoshOutput}
|
||||
===============================================
|
||||
ArangoDB Shell Output {#UserManualArangoshOutput}
|
||||
=================================================
|
||||
|
||||
In general the Arango Shells prints its as output to standard output channel
|
||||
In general the ArangoDB shell prints its as output to standard output channel
|
||||
using the JSON stringifier.
|
||||
|
||||
arangosh> db.five.all().toArray();
|
||||
|
|
|
@ -2,3 +2,4 @@ TOC {#UserManualArangoshTOC}
|
|||
============================
|
||||
|
||||
- @ref UserManualArangosh
|
||||
- @ref UserManualArangoshOutput
|
||||
|
|
|
@ -9,8 +9,9 @@ What is ArangoDB? {#FirstStepsArangoDBIntro}
|
|||
|
||||
ArangoDB is a universal open-source database with a flexible data
|
||||
model for documents, graphs, and key-values. You can easily build high
|
||||
performance applications using a convenient sql-like query language or
|
||||
JavaScript/Ruby extensions.
|
||||
performance applications using a convenient
|
||||
@ref Aql "sql-like query language" or @ref FoxxManager "JavaScript"
|
||||
and Ruby extensions.
|
||||
|
||||
The database server _arangod_ stores all documents and serves them
|
||||
using a REST interface. There are driver for all major language like
|
||||
|
@ -41,51 +42,11 @@ For more in-depth information
|
|||
- read more on the
|
||||
@S_EXTREF_S{http://www.arangodb.org/2012/03/07/avocadodbs-design-objectives,design goals}
|
||||
of ArangoDB
|
||||
- @EXTREF{http://vimeo.com/36411892,watch the video}: Martin Schoenert,
|
||||
- @EXTREF{http://vimeo.com/36411892,watch the video}: Martin Schönert,
|
||||
architect of ArangoDB, gives an introduction of what the ArangoDB project
|
||||
is about
|
||||
- or give it a @S_EXTREF{http://www.arangodb.org/try,try}.
|
||||
|
||||
Getting Familiar with ArangoDB {#FirstStepsArangoDBServerStart}
|
||||
===============================================================
|
||||
|
||||
First of all download and install the corresponding RPM or Debian package or use
|
||||
homebrew on the MacOS X. See the @S_EXTREF_S{InstallManual.html, installation
|
||||
manual} for more details. In case you just want to experiment with ArangoDB you
|
||||
can use the @S_EXTREF_S{http://www.arangodb.org/try,on-line} demo without
|
||||
installing ArangoDB locally.
|
||||
|
||||
For Linux:
|
||||
|
||||
- visit the official ArangoDB download page at
|
||||
@S_EXTREF_S{http://www.arangodb.org/download,http://www.arangodb.org/download}
|
||||
and download the correct package for you Linux distribution
|
||||
- install the package using your favorite package manager
|
||||
- start up the database server, normally this is done by
|
||||
executing `/etc/init.d/arangod start`. The exact command
|
||||
depends on your Linux distribution
|
||||
|
||||
For MacOS X:
|
||||
|
||||
- execute `brew install arangodb`
|
||||
- and start the server using `/usr/local/sbin/arangod &`
|
||||
|
||||
After these steps there should be a running instance of _arangod_ -
|
||||
the ArangoDB database server.
|
||||
|
||||
unix> ps auxw | fgrep arangod
|
||||
arangodb 14536 0.1 0.6 5307264 23464 s002 S 1:21pm 0:00.18 /usr/local/sbin/arangod
|
||||
|
||||
If there is no such process, check the log file
|
||||
`/var/log/arangodb/arangod.log` for errors. If you see a log message
|
||||
like
|
||||
|
||||
2012-12-03T11:35:29Z [12882] ERROR Database directory version (1) is lower than server version (1.2).
|
||||
2012-12-03T11:35:29Z [12882] ERROR It seems like you have upgraded the ArangoDB binary. If this is what you wanted to do, please restart with the --upgrade option to upgrade the data in the database directory.
|
||||
2012-12-03T11:35:29Z [12882] FATAL Database version check failed. Please start the server with the --upgrade option
|
||||
|
||||
make sure to start the server once with the `--upgrade` option.
|
||||
|
||||
|
||||
ArangoDB programs {#FirstStepsArangoDBBinaries}
|
||||
===============================================
|
||||
|
@ -103,6 +64,54 @@ The ArangoDB database package comes with the following programs:
|
|||
See @ref ImpManual
|
||||
|
||||
|
||||
Getting Familiar with ArangoDB {#FirstStepsArangoDBServerStart}
|
||||
===============================================================
|
||||
|
||||
First of all download and install the corresponding RPM or Debian package or use
|
||||
homebrew on the MacOS X. See the @S_EXTREF_S{InstallManual.html, installation
|
||||
manual} for more details. In case you just want to experiment with ArangoDB you
|
||||
can use the @S_EXTREF_S{http://www.arangodb.org/try,on-line} demo without
|
||||
installing ArangoDB locally.
|
||||
|
||||
For Linux:
|
||||
|
||||
- visit the official ArangoDB download page at
|
||||
@S_EXTREF_S{http://www.arangodb.org/download,http://www.arangodb.org/download}
|
||||
and download the correct package for your Linux distribution
|
||||
- install the package using your favorite package manager
|
||||
- start up the database server, normally this is done by
|
||||
executing `/etc/init.d/arangod start`. The exact command
|
||||
depends on your Linux distribution
|
||||
|
||||
For MacOS X:
|
||||
|
||||
- execute `brew install arangodb`
|
||||
- and start the server using `/usr/local/sbin/arangod &`
|
||||
|
||||
For Microsoft Windows:
|
||||
|
||||
- visit the official ArangoDB download page at
|
||||
@S_EXTREF_S{http://www.arangodb.org/download,http://www.arangodb.org/download}
|
||||
and download the installer for Windows
|
||||
- start up the database server
|
||||
|
||||
After these steps there should be a running instance of _arangod_ -
|
||||
the ArangoDB database server.
|
||||
|
||||
unix> ps auxw | fgrep arangod
|
||||
arangodb 14536 0.1 0.6 5307264 23464 s002 S 1:21pm 0:00.18 /usr/local/sbin/arangod
|
||||
|
||||
If there is no such process, check the log file
|
||||
`/var/log/arangodb/arangod.log` for errors. If you see a log message
|
||||
like
|
||||
|
||||
2012-12-03T11:35:29Z [12882] ERROR Database directory version (1) is lower than server version (1.2).
|
||||
2012-12-03T11:35:29Z [12882] ERROR It seems like you have upgraded the ArangoDB binary. If this is what you wanted to do, please restart with the --upgrade option to upgrade the data in the database directory.
|
||||
2012-12-03T11:35:29Z [12882] FATAL Database version check failed. Please start the server with the --upgrade option
|
||||
|
||||
make sure to start the server once with the `--upgrade` option.
|
||||
|
||||
|
||||
Exploring Collections and Documents {#FirstStepsArangoDBFirstSteps}
|
||||
===================================================================
|
||||
|
||||
|
@ -168,10 +177,14 @@ The standard setup does not require a password. Depending on you
|
|||
setup, you might need to specify the endpoint, username and password
|
||||
in order to run the shell on your system. You can use the options
|
||||
`--server.endpoint`, `--server.username` and `--server.password` for
|
||||
this. If you do not specify a password, arangosh will prompt for one.
|
||||
this.
|
||||
|
||||
unix> arangosh --server.endpoint tcp://127.0.0.1:8529 --server.username root
|
||||
|
||||
A default configuration is normally installed under
|
||||
`/etc/arangodb/arangosh.conf`. It contains a default endpoint and an
|
||||
empty password.
|
||||
|
||||
Troubleshooting {#FirstStepsArangoDBTroubleShooting}
|
||||
----------------------------------------------------
|
||||
|
||||
|
@ -245,8 +258,7 @@ All documents are stored in collections. All collections are stored in a
|
|||
database. The database object is accessible there the variable `db` from
|
||||
the module
|
||||
|
||||
arangosh> db = require("org/arangodb").db;
|
||||
[object ArangoDatabase]
|
||||
arangosh> var db = require("org/arangodb").db;
|
||||
|
||||
Creating a collection is simple. You can use the `_create` method
|
||||
of the `db` variable.
|
||||
|
@ -400,6 +412,7 @@ The front-end allows you to browse through the collections and
|
|||
documents. If you need to administrate the database, please use
|
||||
the ArangoDB shell described in the next section.
|
||||
|
||||
|
||||
Details about the ArangoDB Server {#FirstStepsServerStartStop}
|
||||
==============================================================
|
||||
|
||||
|
@ -433,6 +446,9 @@ After starting the server, point your favorite browser to:
|
|||
|
||||
to access the administration front-end.
|
||||
|
||||
Linux
|
||||
-----
|
||||
|
||||
To start the server at system boot time, you should use one of the
|
||||
pre-rolled packages that will install the necessary start / stop
|
||||
scripts for ArangoDB. To start and stop the server manually, you can
|
||||
|
@ -440,11 +456,11 @@ use the start / stop script like this (provided the start / stop script
|
|||
is located in /etc/init.d/arangod, the command actual name and invocation are
|
||||
platform-dependent):
|
||||
|
||||
/etc/init.d/arangod start
|
||||
unix> /etc/init.d/arangod start
|
||||
|
||||
To stop the server, you can use the command
|
||||
|
||||
/etc/init.d/arangod stop
|
||||
unix> /etc/init.d/arangod stop
|
||||
|
||||
You may require root privileges to execute these commands.
|
||||
|
||||
|
@ -456,7 +472,7 @@ line as shown before. To stop the database server gracefully, you can
|
|||
either pressCTRL-C or by send the SIGINT signal to the server process.
|
||||
On many systems, this can be achieved with the following command:
|
||||
|
||||
kill -2 `pidof arangod`
|
||||
unix> kill -2 `pidof arangod`
|
||||
|
||||
Frequently Used Options {#FirstStepsServerStartStopOptions}
|
||||
-----------------------------------------------------------
|
||||
|
@ -495,6 +511,7 @@ more information see @ref CommandLineLogging "here".
|
|||
|
||||
Runs the server as a daemon (as a background process).
|
||||
|
||||
|
||||
Details about the ArangoDB Shell {#FirstStepsShellStartStop}
|
||||
============================================================
|
||||
|
||||
|
@ -517,21 +534,35 @@ Use `--help` to get a list of command-line options:
|
|||
|
||||
unix> ./arangosh --help
|
||||
STANDARD options:
|
||||
--help help message
|
||||
--javascript.modules-path <string> one or more directories separated by cola (default: "...")
|
||||
--javascript.startup-directory <string> startup paths containing the JavaScript files; multiple directories can be separated by cola
|
||||
--audit-log <string> audit log file to save commands and results to
|
||||
--configuration <string> read configuration file
|
||||
--help help message
|
||||
--max-upload-size <uint64> maximum size of import chunks (in bytes) (default: 500000)
|
||||
--no-auto-complete disable auto completion
|
||||
--no-colors deactivate color support
|
||||
--pager <string> output pager (default: "less -X -R -F -L")
|
||||
--pretty-print pretty print values
|
||||
--quiet no banner
|
||||
--temp-path <string> path for temporary files (default: "/tmp/arangodb")
|
||||
--use-pager use pager
|
||||
|
||||
JAVASCRIPT options:
|
||||
--javascript.check <string> syntax check code Javascript code from file
|
||||
--javascript.execute <string> execute Javascript code from file
|
||||
--javascript.execute-string <string> execute Javascript code from string
|
||||
--javascript.modules-path <string> one or more directories separated by semi-colons
|
||||
--javascript.package-path <string> one or more directories separated by semi-colons
|
||||
--javascript.startup-directory <string> startup paths containing the JavaScript files
|
||||
--javascript.unit-tests <string> do not start as shell, run unit tests instead
|
||||
--jslint <string> do not start as shell, run jslint instead
|
||||
--log.level <string> log level (default: "info")
|
||||
--max-upload-size <uint64> maximum size of import chunks (in bytes) (default: 500000)
|
||||
--no-auto-complete disable auto completion
|
||||
--no-colors deactivate color support
|
||||
--pager <string> output pager (default: "less -X -R -F -L")
|
||||
--pretty-print pretty print values
|
||||
--quiet no banner
|
||||
--server.connect-timeout <int64> connect timeout in seconds (default: 3)
|
||||
--server.endpoint <string> endpoint to connect to, use 'none' to start without a server (default: "tcp://127.0.0.1:8529")
|
||||
--server.password <string> password to use when connecting (leave empty for prompt)
|
||||
--server.request-timeout <int64> request timeout in seconds (default: 300)
|
||||
--server.username <string> username to use when connecting (default: "root")
|
||||
--use-pager use pager
|
||||
|
||||
LOGGING options:
|
||||
--log.level <string> log level (default: "info")
|
||||
|
||||
CLIENT options:
|
||||
--server.connect-timeout <double> connect timeout in seconds (default: 3)
|
||||
--server.disable-authentication <bool> disable authentication (default: false)
|
||||
--server.endpoint <string> endpoint to connect to, use 'none' to start without a server (default: "tcp://127.0.0.1:8529")
|
||||
--server.password <string> password to use when connecting (leave empty for prompt)
|
||||
--server.request-timeout <double> request timeout in seconds (default: 300)
|
||||
--server.username <string> username to use when connecting (default: "root")
|
||||
|
|
|
@ -3,13 +3,8 @@ TOC {#FirstStepsArangoDBTOC}
|
|||
|
||||
- @ref FirstStepsArangoDB
|
||||
- @ref FirstStepsArangoDBIntro
|
||||
- @ref FirstStepsArangoDBBinaries
|
||||
- @ref FirstStepsArangoDBServerStart
|
||||
- @ref FirstStepsArangoDBFirstSteps
|
||||
- @ref FirstStepsArangoDBConnecting
|
||||
- @ref FirstStepsArangoDBTroubleShooting
|
||||
- @ref FirstStepsArangoDBQuerying
|
||||
- @ref FirstStepsArangoDBFE
|
||||
- @ref FirstStepsServerStartStop
|
||||
- @ref FirstStepsServerStartStopOptions
|
||||
- @ref FirstStepsShellStartStop
|
||||
- @ref FirstStepsShellStartStopOptions
|
||||
|
|
|
@ -8,14 +8,16 @@ Foxx: Build APIs and simple web applications in ArangoDB{#UserManualFoxxIntro}
|
|||
==============================================================================
|
||||
|
||||
Foxx is an easy way to create APIs and simple web applications from within
|
||||
**ArangoDB**. It is inspired by Sinatra, the classy Ruby web framework. If
|
||||
FoxxApplication is Sinatra,
|
||||
[ArangoDB Actions](http://www.arangodb.org/manuals/current/UserManualActions.html)
|
||||
are the corresponding `Rack`. They provide all the HTTP goodness.
|
||||
ArangoDB. It is inspired by Sinatra, the classy Ruby web framework. If
|
||||
FoxxApplication is Sinatra, @ref UserManualActions are the corresponding
|
||||
`Rack`. They provide all the HTTP goodness.
|
||||
|
||||
So let's get started, shall we?
|
||||
|
||||
An application build with Foxx is written in JavaScript and deployed to ArangoDB
|
||||
Creating the application files
|
||||
------------------------------
|
||||
|
||||
An application built with Foxx is written in JavaScript and deployed to ArangoDB
|
||||
directly. ArangoDB serves this application, you do not need a separate
|
||||
application server.
|
||||
|
||||
|
@ -32,7 +34,7 @@ following content in a file named `app.js` there:
|
|||
var Foxx = require("org/arangodb/foxx");
|
||||
var app = new Foxx.Application(applicationContext);
|
||||
|
||||
app.get("/wiese", function(req, res) {
|
||||
app.get("/meadow", function(req, res) {
|
||||
res.set("Content-Type", "text/plain");
|
||||
res.body = "Worked!"
|
||||
});
|
||||
|
@ -44,6 +46,7 @@ content:
|
|||
{
|
||||
"name": "my_app",
|
||||
"version": "0.0.1",
|
||||
"author": "my and myself",
|
||||
"apps": {
|
||||
"/": "app.js"
|
||||
}
|
||||
|
@ -62,7 +65,10 @@ You should now have the following files and directories with your application
|
|||
|
||||
This is your application.
|
||||
|
||||
Now your application is done. Start ArangoDB as follows:
|
||||
Testing the application
|
||||
-----------------------
|
||||
|
||||
Now your application is ready to be tested. Start ArangoDB as follows:
|
||||
|
||||
$ arangod --javascript.dev-app-path /home/user/apps /tmp/fancy_db
|
||||
|
||||
|
@ -75,110 +81,41 @@ Replace `/home/user/apps` with the apps path that you initially created. This is
|
|||
the path that you created the `my_app` directory in. Replace `/tmp/fancy_db`
|
||||
with the directory your database is located in.
|
||||
|
||||
Now point your browser to `http://localhost:8529/dev/my_app/wiese` and you
|
||||
Now point your browser to `http://localhost:8529/dev/my_app/meadow` and you
|
||||
should see "Worked!". After this short overview, let's get into the details.
|
||||
|
||||
## Fishbowl - Foxx's app repository
|
||||
|
||||
Foxx comes with a repository of apps other people created. This repository is called "fishbowl". You can access the
|
||||
repository through arangosh:
|
||||
Handling Requests{#UserManualFoxxHandlingRequests}
|
||||
==================================================
|
||||
|
||||
$ arangosh
|
||||
arangosh> aal = require('org/arangodb/aal');
|
||||
arangosh> aal.updateFishbowl();
|
||||
arangosh> aal.listFishbowl();
|
||||
If you do not redefine it, all requests that go to the root of your application
|
||||
will be redirected to `index.html`.
|
||||
|
||||
This updates the list of available apps and displays the list. Let's assume you want to install the demo todo app called
|
||||
"aye_aye". First get a list of all available versions of "aye_aye":
|
||||
|
||||
arangosh> aal.details("aye_aye");
|
||||
Details on Foxx.Application{#UserManualFoxxDetails}
|
||||
===================================================
|
||||
|
||||
The following command can be copied from the results of the previous details command. To download version 1.0.8 of
|
||||
"aye_aye" from github repository run:
|
||||
|
||||
arangosh> aal.load("github", "mchacki/aye_aye", "v1.0.8");
|
||||
|
||||
The response contains the full path to the directory where "aye_aye" was saved.
|
||||
The last step is to mount "aye_aye" to a route of your choice, e.g.
|
||||
|
||||
arangosh> aal.installApp("aye_aye","/todos");
|
||||
|
||||
You can now use aye_aye in your browser at `http://localhost:8529/todos`.
|
||||
|
||||
## Details on Foxx.Application
|
||||
|
||||
#### new Foxx.Application
|
||||
@copydetails JSF_foxx_application_initializer
|
||||
|
||||
#### Foxx.Application#start
|
||||
@copydetails JSF_foxx_application_start
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_createRepository
|
||||
|
||||
#### Foxx.Application#requires
|
||||
|
||||
Using the base paths defined in the manifest file, you can require modules that you need in this FoxxApplication.
|
||||
So for example:
|
||||
|
||||
app.requires = {
|
||||
"sheepskin": "wolf"
|
||||
};
|
||||
|
||||
This will require the file `wolf.js` in the libs folder you have defined and make the module available via the variable
|
||||
`sheepskin` in your FoxxApplication definitions:
|
||||
|
||||
app.get("/bark", function (req, res) {
|
||||
sheepskin.bark();
|
||||
});
|
||||
|
||||
*Please note that you cannot use the normal require syntax in a `FoxxApplication`, because it's a special DSL and not a
|
||||
normal JavaScript file.*
|
||||
|
||||
#### Foxx.Application#registerRepository
|
||||
|
||||
A repository is a module that gets data from the database or saves data to it. A model is a representation of data which
|
||||
will be used by the repository. Use this method to register a repository and a corresponding model. They can then be
|
||||
used in your handlers via `repository.name` where name is the registered name.
|
||||
|
||||
Foxx = require("org/arangodb/foxx");
|
||||
|
||||
app = new Foxx.Application({});
|
||||
|
||||
app.registerRepository("todos", {
|
||||
model: "models/todos",
|
||||
repository: "repositories/todos"
|
||||
});
|
||||
|
||||
If you do not give a repository, it will default to the `Foxx.Repository`. If you need more than the methods provided by
|
||||
it, you must give the path (relative to your lib directory) to your repository module there. Then you can extend the
|
||||
Foxx.Repository prototype and add your own methods.
|
||||
|
||||
If you do not give a model, it will default to the `Foxx.Model`. If you need more than the methods provided by it, you
|
||||
must give the path (relative to your lib directory) to your model module there. Then you can extend the Foxx.Model
|
||||
prototype and add your own methods.
|
||||
|
||||
If you don't need either of those, you don't need to give an empty object. You can then just call:
|
||||
|
||||
app.registerRepository("todos");
|
||||
|
||||
### Handling Requests
|
||||
|
||||
If you do not redefine it, all requests that go to the root of your application will be redirected to `index.html`.
|
||||
|
||||
#### Foxx.Application#head
|
||||
@copydetails JSF_foxx_application_head
|
||||
|
||||
#### Foxx.Application#get
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_get
|
||||
|
||||
#### Foxx.Application#post
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_head
|
||||
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_post
|
||||
|
||||
#### Foxx.Application#put
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_put
|
||||
|
||||
#### Foxx.Application#patch
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_patch
|
||||
|
||||
#### Foxx.Application#delete
|
||||
@CLEARPAGE
|
||||
@copydetails JSF_foxx_application_delete
|
||||
|
||||
### Documenting and Constraining the Routes
|
||||
|
|
|
@ -0,0 +1,274 @@
|
|||
Foxx Manager {#UserManualFoxxManager}
|
||||
=====================================
|
||||
|
||||
@NAVIGATE_UserManualFoxxManager
|
||||
@EMBEDTOC{UserManualFoxxManagerTOC}
|
||||
|
||||
Foxx Applications{#UserManualFoxxManagerIntro}
|
||||
==============================================
|
||||
|
||||
Foxx is an easy way to create APIs and simple web applications from within
|
||||
ArangoDB. It is inspired by Sinatra, the classy Ruby web framework. An
|
||||
application built with Foxx is written in JavaScript and deployed to ArangoDB
|
||||
directly. ArangoDB serves this application, you do not need a separate
|
||||
application server.
|
||||
|
||||
In order to share your applications with the community, we have created a
|
||||
central github repository
|
||||
|
||||
https://github.com/triAGENS/foxx-apps
|
||||
|
||||
where you can register your applications. This repository also contains the hello
|
||||
world application for Foxx.
|
||||
|
||||
Applications are managed using the Foxx manager `foxx-mananger`. It is similar
|
||||
to tools like `brew` or `aptitude`.
|
||||
|
||||
First Steps with the Foxx Manager{#UserManualFoxxManagerFirstSteps}
|
||||
===================================================================
|
||||
|
||||
The Foxx manager is a shell programm. It should have been installed under
|
||||
`/usr/bin` when installing the ArangoDB package. An instance of the
|
||||
ArangoDB server must be up and running.
|
||||
|
||||
unix> foxx-manager
|
||||
Expecting a command, please try:
|
||||
|
||||
Example usage:
|
||||
foxx-manager install <foxx> <mount-point>
|
||||
foxx-manager uninstall <mount-point>
|
||||
|
||||
Further help:
|
||||
foxx-manager help
|
||||
|
||||
The most important commands are
|
||||
|
||||
* `install`: fetches a foxx application from the central foxx-apps repository,
|
||||
mounts it to a local URL and sets it up
|
||||
|
||||
* `uninstall`: unmounts a mounted foxx application and calls its teardown method
|
||||
|
||||
* `list`: lists all installed foxx applications
|
||||
|
||||
When dealing with a fresh install of ArangoDB, there should be no installed
|
||||
applications besides the system applications delivered with ArangoDB.
|
||||
|
||||
unix> foxx-manager list
|
||||
Name Author Description AppID Version Mount Active System
|
||||
--------- ------------------ -------------------------------------------------------- ----------------- -------- ----------------- ------- -------
|
||||
aardvark Michael Hackstein Foxx application manager for the ArangoDB web interface app:aardvark:1.0 1.0 /_admin/aardvark yes yes
|
||||
--------- ------------------ -------------------------------------------------------- ----------------- -------- ----------------- ------- -------
|
||||
1 application(s) found
|
||||
|
||||
There is currently one application installed. It is called "aardvark" and it is
|
||||
a system application. You can safely ignore system applications.
|
||||
|
||||
We are now going to install the hello world application. It is called
|
||||
"hello-world" - no suprise there.
|
||||
|
||||
unix> foxx-manager install hallo-world /example
|
||||
Application app:hello-foxx:1.2.2 installed successfully at mount point /example
|
||||
|
||||
The second parameter `/example` is the mount path of the application. You should now
|
||||
be able to access the example application under
|
||||
|
||||
http://localhost:8529/example
|
||||
|
||||
using your favorite browser. It will now also be visible when using the `list`
|
||||
command.
|
||||
|
||||
unix> foxx-manager list
|
||||
Name Author Description AppID Version Mount Active System
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 /example yes no
|
||||
aardvark Michael Hackstein Foxx application manager for the ArangoDB web interface app:aardvark:1.0 1.0 /_admin/aardvark yes yes
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
2 application(s) found
|
||||
|
||||
You can install the application again under different mount path.
|
||||
|
||||
unix> foxx-manager install hallo-world /hello
|
||||
Application app:hello-foxx:1.2.2 installed successfully at mount point /hello
|
||||
|
||||
You now have to separated instances of the same application. They are completely
|
||||
independent of each other.
|
||||
|
||||
unix> foxx-manager list
|
||||
Name Author Description AppID Version Mount Active System
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 /example yes no
|
||||
aardvark Michael Hackstein Foxx application manager for the ArangoDB web interface app:aardvark:1.0 1.0 /_admin/aardvark yes yes
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 /hello yes no
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
3 application(s) found
|
||||
|
||||
The current version of the application is `1.2.2` (check the output of `list`
|
||||
for the current version). It is even possible to mount a different version of
|
||||
an application.
|
||||
|
||||
Now let's remove the instanced mounted under `/hello`.
|
||||
|
||||
unix> foxx-manager uninstall /hello
|
||||
Application app:hello-foxx:1.2.2 unmounted successfully from mount point /hello
|
||||
|
||||
Behind the Foxx Manager scenes{#UserManualFoxxManagerBehindScences}
|
||||
===================================================================
|
||||
|
||||
In the previous chapter we have seen how to install and install applications.
|
||||
We now go into more details.
|
||||
|
||||
There are five steps when installing or uninstalling applications.
|
||||
|
||||
* fetch the application from a source
|
||||
* mount the application at a mount path
|
||||
* setup the application, creating the necessary collections
|
||||
* teardown the application, removing the application-specific collections
|
||||
* unmount the application
|
||||
|
||||
When installing an application, the steps "fetch", "mount", and "setup" are
|
||||
executed automatically. When uninstalling an application, the steps "teardown"
|
||||
and "unmount" are executed automatically.
|
||||
|
||||
Installing an application manually
|
||||
----------------------------------
|
||||
|
||||
We are now going to install the hello world application manually. You can use
|
||||
`search` to find application in your local copy of the central repository.
|
||||
|
||||
So, first we update our local copy to get the newest versions from the central
|
||||
repository.
|
||||
|
||||
unix> foxx-manager update
|
||||
Updated local repository information with 4 application(s)
|
||||
|
||||
You can now search for words with the description of an application.
|
||||
|
||||
unix> foxx-manager search hello
|
||||
Name Author Description
|
||||
----------- ------------- -----------------------------------------
|
||||
hello-foxx Frank Celler This is 'Hello World' for ArangoDB Foxx.
|
||||
----------- ------------- -----------------------------------------
|
||||
1 application(s) found
|
||||
|
||||
As soon as you know the name of the application, you can check its details.
|
||||
|
||||
unix> foxx-manager info hello-foxx
|
||||
Name: hello-foxx
|
||||
Author: Frank Celler
|
||||
System: false
|
||||
Description: This is 'Hello World' for ArangoDB Foxx.
|
||||
|
||||
Versions:
|
||||
1.1.0: fetch github "fceller/hello-foxx" "v1.1.0"
|
||||
1.1.1: fetch github "fceller/hello-foxx" "v1.1.1"
|
||||
1.2.0: fetch github "fceller/hello-foxx" "v1.2.0"
|
||||
1.2.1: fetch github "fceller/hello-foxx" "v1.2.1"
|
||||
1.2.2: fetch github "fceller/hello-foxx" "v1.2.2"
|
||||
|
||||
If you execute
|
||||
|
||||
unix> foxx-manager fetch github "fceller/hello-foxx" "v1.2.1"
|
||||
|
||||
then the version 1.2.1 of the application will be downloaded. The command `fetched`
|
||||
lists all fetched application.
|
||||
|
||||
unix> foxx-manager fetched
|
||||
Name Author Description AppID Version Path
|
||||
----------- ------------- ------------------------------ --------------------- -------- -----------------
|
||||
hello-foxx A simple example application. app:hello-foxx:1.2.1 1.2.1 hello-foxx-1.2.1
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 hello-foxx-1.2.2
|
||||
----------- ------------- ------------------------------ --------------------- -------- -----------------
|
||||
2 application(s) found
|
||||
|
||||
We have now two versions of the hello world application. The current version
|
||||
fetched when installing the application using `install` and the one fetched now.
|
||||
|
||||
Let's now mount the application in version 1.2.1 under `/hello`.
|
||||
|
||||
unix> foxx-manager mount app:hello-foxx:1.2.1 /hello
|
||||
unix> foxx-manager list
|
||||
Name Author Description AppID Version Mount Active System
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.1 1.2.1 /hello yes no
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 /example yes no
|
||||
aardvark Michael Hackstein Foxx application manager for the ArangoDB web interface app:aardvark:1.0 1.0 /_admin/aardvark yes yes
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
3 application(s) found
|
||||
|
||||
The application is mounted but not yet initialized. If you check the available
|
||||
collections, you will see that there is no collection called `hello_texts`.
|
||||
|
||||
arangosh> db._collections()
|
||||
[
|
||||
[ArangoCollection 2965927, "_routing" (type document, status loaded)],
|
||||
[ArangoCollection 96682407, "example_texts" (type document, status loaded)],
|
||||
...
|
||||
]
|
||||
|
||||
A collection `example_texts` exists. This belongs to the mounted application at
|
||||
`/example`. If we set-up the application, then the setup script will create the
|
||||
missing collection.
|
||||
|
||||
unix> foxx-manager setup /hello
|
||||
|
||||
Now check the list of collections again.
|
||||
|
||||
arangosh> db._collections()
|
||||
[
|
||||
[ArangoCollection 2965927, "_routing" (type document, status loaded)],
|
||||
[ArangoCollection 96682407, "example_texts" (type document, status unloaded)],
|
||||
[ArangoCollection 172900775, "hello_texts" (type document, status loaded)],
|
||||
...
|
||||
]
|
||||
|
||||
You can now use the mounted and initialized application.
|
||||
|
||||
unix> foxx-manager list
|
||||
Name Author Description AppID Version Mount Active System
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.2 1.2.2 /example yes no
|
||||
hello-foxx Frank Celler A simple example application. app:hello-foxx:1.2.1 1.2.1 /hello yes no
|
||||
aardvark Michael Hackstein Foxx application manager for the ArangoDB web interface app:aardvark:1.0 1.0 /_admin/aardvark yes yes
|
||||
----------- ------------------ -------------------------------------------------------- --------------------- -------- ----------------- ------- -------
|
||||
3 application(s) found
|
||||
|
||||
As you can see, there are two instances of the application under two mount
|
||||
paths in two different versions. As the collections are not shared between
|
||||
applications, they are completely independent from each other.
|
||||
|
||||
Uninstalling an application manually
|
||||
------------------------------------
|
||||
|
||||
Now let us uninstall the application again. First we have to call the teardown
|
||||
script, which will remove the collection `hello_texts`.
|
||||
|
||||
unix> foxx-manager teardown /hello
|
||||
|
||||
This will drop the collection `hello_exists`. The application is, however, still
|
||||
reachable. We still need to unmount it.
|
||||
|
||||
unix> foxx-manager unmount /hello
|
||||
|
||||
Frequently Used Options {#UserManualFoxxManagerOptions}
|
||||
=======================================================
|
||||
|
||||
Use `help` to see all options
|
||||
|
||||
unix> foxx-manager help
|
||||
|
||||
The following commands are available:
|
||||
fetch fetches a foxx application from the central foxx-apps repository into the local repository
|
||||
mount mounts a fetched foxx application to a local URL
|
||||
setup setup executes the setup script (app must already be mounted)
|
||||
install fetches a foxx application from the central foxx-apps repository, mounts it to a local URL and sets it up
|
||||
teardown teardown execute the teardown script (app must be still be mounted)
|
||||
unmount unmounts a mounted foxx application
|
||||
uninstall unmounts a mounted foxx application and calls its teardown method
|
||||
purge physically removes a foxx application and all mounts
|
||||
list lists all installed foxx applications
|
||||
fetched lists all fetched foxx applications that were fetched into the local repository
|
||||
available lists all foxx applications available in the local repository
|
||||
info displays information about a foxx application
|
||||
search searches the local foxx-apps repository
|
||||
update updates the local foxx-apps repository with data from the central foxx-apps repository
|
||||
help shows this help
|
|
@ -0,0 +1,8 @@
|
|||
TOC {#UserManualFoxxManagerTOC}
|
||||
===============================
|
||||
|
||||
- @ref UserManualFoxxManager
|
||||
- @ref UserManualFoxxManagerIntro
|
||||
- @ref UserManualFoxxManagerFirstSteps
|
||||
- @ref UserManualFoxxManagerBehindScences
|
||||
- @ref UserManualFoxxManagerOptions
|
|
@ -2,3 +2,6 @@ TOC {#UserManualFoxxTOC}
|
|||
========================
|
||||
|
||||
- @ref UserManualFoxx
|
||||
- @ref UserManualFoxxIntro
|
||||
- @ref UserManualFoxxHandlingRequests
|
||||
- @ref UserManualFoxxDetails
|
||||
|
|
|
@ -12,7 +12,7 @@ collections from the JavaScript shell _arangosh_. For other languages see the
|
|||
corresponding language API.
|
||||
|
||||
The most import call is the call to create a new collection, see
|
||||
@ref HandlingCollectionsCreate "_create".
|
||||
@ref HandlingCollectionsCreate "db._create".
|
||||
|
||||
@copydoc GlossaryCollection
|
||||
|
||||
|
@ -25,15 +25,14 @@ Address of a Collection {#HandlingCollectionsResource}
|
|||
|
||||
All collections in ArangoDB have an unique identifier and a unique
|
||||
name. ArangoDB internally uses the collection's unique identifier to look up
|
||||
collections. This identifier however is managed by ArangoDB and the user has no
|
||||
control over it. In order to allow users use their own names, each collection
|
||||
collections. This identifier, however, is managed by ArangoDB and the user has
|
||||
no control over it. In order to allow users use their own names, each collection
|
||||
also has a unique name, which is specified by the user. To access a collection
|
||||
from the user perspective, the collection name should be used, i.e.:
|
||||
|
||||
db._collection(@FA{collection-name})
|
||||
|
||||
A collection is created by a @FN{db._create} call, see @ref
|
||||
HandlingCollectionsCreate "_create".
|
||||
A collection is created by a @ref HandlingCollectionsCreate "db._create" call.
|
||||
|
||||
For example: Assume that the collection identifier is `7254820` and the name is
|
||||
`demo`, then the collection can be accessed as:
|
||||
|
@ -49,8 +48,9 @@ There is a short-cut that can be used for non-system collections:
|
|||
This call will either return the collection named @FA{collection-name} or create
|
||||
a new one with that name and a set of default properties.
|
||||
|
||||
Note: creating a collection on the fly using @LIT{db.@FA{collection-name}} does
|
||||
not work in arangosh. To create a new collection from arangosh, please use
|
||||
Note: creating a collection on the fly using @LIT{db.@FA{collection-name}} is
|
||||
not recommend and does not work in arangosh. To create a new collection, please
|
||||
use
|
||||
|
||||
db._create(@FA{collection-name})
|
||||
|
||||
|
|
|
@ -14,8 +14,9 @@ ArangoDB's User Manual (@VERSION) {#UserManual}
|
|||
@CHAPTER_REF{Aql}
|
||||
@CHAPTER_REF{ExtendingAql}
|
||||
@CHAPTER_REF{AqlExamples}
|
||||
@CHAPTER_REF{UserManualActions}
|
||||
@CHAPTER_REF{UserManualFoxxManager}
|
||||
@CHAPTER_REF{UserManualFoxx}
|
||||
@CHAPTER_REF{UserManualActions}
|
||||
@CHAPTER_REF{Transactions}
|
||||
@CHAPTER_REF{CommandLine}
|
||||
@CHAPTER_REF{Glossary}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ArangoDB's Web-Interface {#UserManualWebInterface}
|
||||
==================================================
|
||||
The ArangoDB Web-Interface {#UserManualWebInterface}
|
||||
====================================================
|
||||
|
||||
@NAVIGATE_UserManualWebInterface
|
||||
@EMBEDTOC{UserManualWebInterfaceTOC}
|
||||
|
|
|
@ -241,7 +241,7 @@ ALIASES += \
|
|||
|
||||
# examples
|
||||
ALIASES += \
|
||||
"EXAMPLES=@htmlonly<H3>Examples</H3>@endhtmlonly" \
|
||||
"EXAMPLES=@htmlonly<p><b>Examples</b></p>@endhtmlonly" \
|
||||
"EXAMPLE_ARANGOSH_OUTPUT{1}=@verbinclude \1.generated@if IGNORE" \
|
||||
"END_EXAMPLE_ARANGOSH_OUTPUT=@endif" \
|
||||
"EXAMPLE_ARANGOSH_RUN{1}=@verbinclude \1.generated@if IGNORE" \
|
||||
|
@ -260,7 +260,7 @@ ALIASES += \
|
|||
# table of content
|
||||
ALIASES += \
|
||||
"BOOK_REF{1}=@ref \1" \
|
||||
"CHAPTER_REF{1}=@if LATEX - @ref \1\n@else@copydetails \1TOC@endif"
|
||||
"CHAPTER_REF{1}=- @ref \1\n"
|
||||
|
||||
# other aliases
|
||||
ALIASES += \
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
margin: 0 0 20px;
|
||||
text-align: left;
|
||||
}
|
||||
#content div.arangodb h3 {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
#content div.arangodb div.headertitle {
|
||||
border-bottom: 1px solid #EFECE9;
|
||||
|
@ -62,6 +58,12 @@
|
|||
padding: 14px 0 3px;
|
||||
}
|
||||
|
||||
#content div.arangodb h3 {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 14px;
|
||||
border-bottom: 1px solid #EFECE9;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* navigation bar */
|
||||
/* ************************************************************************** */
|
||||
|
@ -80,7 +82,7 @@
|
|||
#content div.arangodb div.toc {
|
||||
border-width: thin;
|
||||
border-style: solid;
|
||||
background-color: #F8F8F8;
|
||||
background-color: #E7F3C5;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
|
@ -103,7 +105,12 @@
|
|||
/* ************************************************************************** */
|
||||
|
||||
#content div.arangodb div.functionsignature {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
font-family: monospace,fixed;
|
||||
border: 2px dotted;
|
||||
background-color: #F8F8F8;
|
||||
padding: 10px;
|
||||
margin-top: 14px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
@ -213,12 +220,11 @@
|
|||
|
||||
#content div.arangodb pre {
|
||||
background-color: #FBFCFD !important;
|
||||
border: 1px solid #C4CFE5 !important;
|
||||
border: 0px;
|
||||
font-family: monospace,fixed;
|
||||
font-size: 105%;
|
||||
font-size: 15px;
|
||||
line-height: 21px;
|
||||
margin: 4px 8px 24px 2px;
|
||||
margin: 4px 8px 24px 36px;
|
||||
overflow: auto;
|
||||
padding: 4px 6px;
|
||||
word-wrap: break-word;
|
||||
|
@ -226,15 +232,15 @@
|
|||
|
||||
#content div.arangodb div.fragment {
|
||||
background-color: #FBFCFD !important;
|
||||
border: 1px solid #C4CFE5 !important;
|
||||
border: 0px;
|
||||
font-family: monospace,fixed;
|
||||
font-size: 105%;
|
||||
font-size: 15px;
|
||||
line-height: 21px;
|
||||
margin: 4px 8px 24px 2px;
|
||||
line-height: 11px;
|
||||
margin: 4px 8px 24px 36px;
|
||||
overflow: auto;
|
||||
padding: 4px 6px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#content div.arangodb code {
|
||||
|
|
|
@ -856,7 +856,7 @@ exports.install = function (name, mount, options) {
|
|||
// .............................................................................
|
||||
|
||||
if (source === null) {
|
||||
throw new Error("Unknown foxx application '%s', use search", name);
|
||||
throw new Error("Unknown foxx application '" + name + "', use search");
|
||||
}
|
||||
|
||||
if (source !== "fetched") {
|
||||
|
|
|
@ -372,8 +372,6 @@ function mountAalApp (app, mount, options) {
|
|||
prefix = prefixFromMount(mount);
|
||||
}
|
||||
|
||||
setupApp(app, mount, prefix);
|
||||
|
||||
// .............................................................................
|
||||
// create a new (unique) entry in aal
|
||||
// .............................................................................
|
||||
|
|
|
@ -83,17 +83,20 @@ internal.createUrlObject = function (url, constraint, method) {
|
|||
/// @fn JSF_foxx_application_initializer
|
||||
/// @brief Create a new Application
|
||||
///
|
||||
/// This creates a new Application. It takes two optional arguments as displayed
|
||||
/// above:
|
||||
/// @FUN{new Foxx.Application(@FA{applicationContext}, @FA{options})}
|
||||
///
|
||||
/// This creates a new Application. The first argument is the application
|
||||
/// context avail in the variable `applicationContext`. The second one is an
|
||||
/// options array with the following attributes:
|
||||
///
|
||||
/// * **The URL Prefix:** All routes you define within will be prefixed with it
|
||||
/// * **The Template Collection:** More information in the template section
|
||||
/// * `urlPrefix`: All routes you define within will be prefixed with it.
|
||||
/// * `templateCollection`: More information in the template section.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app = new Application(applicationContext, {
|
||||
/// urlPrefix: "/wiese",
|
||||
/// urlPrefix: "/meadow",
|
||||
/// templateCollection: "my_templates"
|
||||
/// });
|
||||
/// @endcode
|
||||
|
@ -165,6 +168,37 @@ _.extend(Application.prototype, {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_application_createRepository
|
||||
/// @brief Create a repository
|
||||
///
|
||||
/// @FUN{app.createRepository(@FA{name}, @FA{options})}
|
||||
///
|
||||
/// A repository is a module that gets data from the database or saves data to
|
||||
/// it. A model is a representation of data which will be used by the
|
||||
/// repository. Use this method to create a repository and a corresponding
|
||||
/// model.
|
||||
///
|
||||
/// @code
|
||||
/// Foxx = require("org/arangodb/foxx");
|
||||
///
|
||||
/// app = new Foxx.Application(applicationContext);
|
||||
///
|
||||
/// var todos = app.createRepository("todos", {
|
||||
/// model: "models/todos",
|
||||
/// repository: "repositories/todos"
|
||||
/// });
|
||||
/// @endcode
|
||||
///
|
||||
//// If you do not give a repository, it will default to the
|
||||
/// `Foxx.Repository`. If you need more than the methods provided by it, you
|
||||
/// must give the path (relative to your lib directory) to your repository
|
||||
/// module there. Then you can extend the Foxx.Repository prototype and add your
|
||||
/// own methods.
|
||||
///
|
||||
/// If you don't need either of those, you don't need to give an empty
|
||||
/// object. You can then just call:
|
||||
///
|
||||
/// @code
|
||||
/// var todos = app.createRepository("todos");
|
||||
/// @endcode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
createRepository: function (name, opts) {
|
||||
|
@ -214,16 +248,8 @@ _.extend(Application.prototype, {
|
|||
/// probably wont call it directly, but it is used in the other request methods:
|
||||
///
|
||||
/// When defining a route you can also define a so called 'parameterized' route
|
||||
/// like `/gaense/:stable`. In this case you can later get the value the user
|
||||
/// provided for `stable` via the `params` function (see the Request object).
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.handleRequest("get", "/gaense", function (req, res) {
|
||||
/// //handle the request
|
||||
/// });
|
||||
/// @endcode
|
||||
/// like `/goose/:barn`. In this case you can later get the value the user
|
||||
/// provided for `barn` via the `params` function (see the Request object).
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
handleRequest: function (method, route, callback) {
|
||||
|
@ -248,10 +274,11 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_head
|
||||
/// @brief Handle a `head` request
|
||||
///
|
||||
/// This handles requests from the HTTP verb `head`. As with all other requests
|
||||
/// you can give an option as the third argument, or leave it blank. You have to
|
||||
/// give a function as the last argument however. It will get a request and
|
||||
/// response object as its arguments
|
||||
/// @FUN{app.head(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `head`. You have to give a
|
||||
/// function as @FA{callback}. It will get a request and response object as its
|
||||
/// arguments
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
head: function (route, callback) {
|
||||
|
@ -263,13 +290,19 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_get
|
||||
/// @brief Manage a `get` request
|
||||
///
|
||||
/// This handles requests from the HTTP verb `get`. See above for the arguments
|
||||
/// you can give. An example:
|
||||
/// @FUN{app.get(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `get`.
|
||||
///
|
||||
/// When defining a route you can also define a so called 'parameterized'
|
||||
/// @FA{path} like `/goose/:barn`. In this case you can later get the value
|
||||
/// the user provided for `barn` via the `params` function (see the Request
|
||||
/// object).
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.get('/gaense/stall', function (req, res) {
|
||||
/// app.get('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
/// @endcode
|
||||
|
@ -284,13 +317,15 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_post
|
||||
/// @brief Tackle a `post` request
|
||||
///
|
||||
/// @FUN{app.post(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `post`. See above for the
|
||||
/// arguments you can give. An example:
|
||||
/// arguments you can give.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.post('/gaense/stall', function (req, res) {
|
||||
/// app.post('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
/// @endcode
|
||||
|
@ -305,13 +340,15 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_put
|
||||
/// @brief Sort out a `put` request
|
||||
///
|
||||
/// @FUN{app.post(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `put`. See above for the arguments
|
||||
/// you can give. An example:
|
||||
/// you can give.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.put('/gaense/stall', function (req, res) {
|
||||
/// app.put('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
/// @endcode
|
||||
|
@ -326,13 +363,15 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_patch
|
||||
/// @brief Take charge of a `patch` request
|
||||
///
|
||||
/// @FUN{app.patch(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `patch`. See above for the
|
||||
/// arguments you can give. An example:
|
||||
/// arguments you can give.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.patch('/gaense/stall', function (req, res) {
|
||||
/// app.patch('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
/// @endcode
|
||||
|
@ -347,21 +386,23 @@ _.extend(Application.prototype, {
|
|||
/// @fn JSF_foxx_application_delete
|
||||
/// @brief Respond to a `delete` request
|
||||
///
|
||||
/// @FUN{app.patch(@FA{path}, @FA{callback})}
|
||||
///
|
||||
/// This handles requests from the HTTP verb `delete`. See above for the
|
||||
/// arguments you can give.
|
||||
///
|
||||
/// **A word of warning:** Do not forget that `delete` is a reserved word in
|
||||
/// JavaScript and therefore needs to be called as app['delete']. There is also
|
||||
/// an alias `del` for this very reason.
|
||||
/// @warning Do not forget that `delete` is a reserved word in JavaScript and
|
||||
/// therefore needs to be called as app['delete']. There is also an alias `del`
|
||||
/// for this very reason.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app['delete']('/gaense/stall', function (req, res) {
|
||||
/// app['delete']('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
///
|
||||
/// app.del('/gaense/stall', function (req, res) {
|
||||
/// app.del('/goose/barn', function (req, res) {
|
||||
/// // Take this request and deal with it!
|
||||
/// });
|
||||
/// @endcode
|
||||
|
|
|
@ -312,7 +312,16 @@ namespace triagens {
|
|||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @verbinclude option-server-endpoint
|
||||
/// @code
|
||||
/// unix> ./arangod --server.endpoint tcp://127.0.0.1:8529
|
||||
/// --server.endpoint ssl://127.0.0.1:8530
|
||||
/// --server.keyfile server.pem /tmp/vocbase
|
||||
/// 2012-07-26T07:07:47Z [8161] INFO using SSL protocol version 'TLSv1'
|
||||
/// 2012-07-26T07:07:48Z [8161] INFO using endpoint 'ssl://127.0.0.1:8530' for http ssl requests
|
||||
/// 2012-07-26T07:07:48Z [8161] INFO using endpoint 'tcp://127.0.0.1:8529' for http tcp requests
|
||||
/// 2012-07-26T07:07:49Z [8161] INFO ArangoDB (version 1.1.alpha) is ready for business
|
||||
/// 2012-07-26T07:07:49Z [8161] INFO Have Fun!
|
||||
/// @endcode
|
||||
///
|
||||
/// Note that if you are using SSL-encrypted endpoints, you must also supply
|
||||
/// the path to a server certificate using the \-\-server.keyfile option.
|
||||
|
|
Loading…
Reference in New Issue