From b08a169b4cbd1f08818cd64d4c1292bd00a56203 Mon Sep 17 00:00:00 2001 From: Doerthe Luebbert Date: Fri, 27 Sep 2013 11:39:22 +0200 Subject: [PATCH 1/2] replaced the meadow example by hello + param example --- Documentation/UserManual/Foxx.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/UserManual/Foxx.md b/Documentation/UserManual/Foxx.md index 1616baf4ca..af2cad2277 100644 --- a/Documentation/UserManual/Foxx.md +++ b/Documentation/UserManual/Foxx.md @@ -26,7 +26,7 @@ ArangoDB directly. ArangoDB serves this application, you do not need a separate application server. So given you want to build an application that sends a plain-text response -"Worked!" for all requests to `/dev/my_app/meadow`. How would you achieve that +"Hello YourName!" for all requests to `/dev/my_app/hello/YourName`. How would you achieve that with Foxx? First, create a directory `apps` somewhere in your filesystem. Let's assume @@ -41,9 +41,9 @@ save the following content in a file named `app.js` there: var Foxx = require("org/arangodb/foxx"), controller = new Foxx.Controller(applicationContext) - controller.get("/meadow", function(req, res) { + controller.get("/hello/:name", function(req, res) { res.set("Content-Type", "text/plain"); - res.body = "Worked!" + res.body = "Hello " + req.params("name"); }); }()); @@ -91,8 +91,8 @@ 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/meadow` and you should -see "Worked!". After this short overview, let's get into the details. +Now point your browser to `http://localhost:8529/dev/my_app/hello/YourName` and you should +see "Hello YourName". After this short overview, let's get into the details. Handling Requests{#UserManualFoxxHandlingRequests} From b8f23c368a35996dffedbd9d9c22b6499487091b Mon Sep 17 00:00:00 2001 From: Doerthe Luebbert Date: Fri, 27 Sep 2013 12:26:15 +0200 Subject: [PATCH 2/2] Info added on example apps --- Documentation/UserManual/Foxx.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Documentation/UserManual/Foxx.md b/Documentation/UserManual/Foxx.md index af2cad2277..f576027b47 100644 --- a/Documentation/UserManual/Foxx.md +++ b/Documentation/UserManual/Foxx.md @@ -92,8 +92,16 @@ 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/hello/YourName` and you should -see "Hello YourName". After this short overview, let's get into the details. +see "Hello YourName". +After this short overview, let's get into the details. There are several example +apps available on Github. You can install them via Foxx manager (covered in the +chapter on Foxx manager) or simply clone them from `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, login and check permissions. Handling Requests{#UserManualFoxxHandlingRequests} ================================================== @@ -569,12 +577,13 @@ This means that you do not have to restart ArangoDB if you change anything in your app. It is of course not meant for production, because the reloading makes the app relatively slow. -Deploying on Production ------------------------ +Production Mode +--------------- +To run a Foxx app in production first copy your app code to the directory given in +the config variable `--javascript.app-path`. After that use Foxx manager to mount the app. +You can also use Foxx manager to find out your current app-path. -*The Production mode is in development right now.* - -We will offer the option to process all assets at once and write the files +In later versions we will offer the option to process all assets at once and write the files to disk for production with the option to run `Uglify2.js` and similar tools in order to compress them.