GithubHelp home page GithubHelp logo

aye_aye's Introduction

aye_aye

A TodoMVC Foxx application written for ArangoDB.

The goal of Foxx apps implemented in ArangoDB is to easily create simple REST interfaces. The included asset pipeline allows it to deliver complete single page applications (e.g. using Backbone.js) without a separate backend layer written in an arbitrary web framework. A Foxx app can be used to provide a basic application logic and a persistent data-storage in ArangoDB.

aye_aye is an introducing example for this. It consists of a simple frontend and backend component.

Frontend

The backbone frontend is based on TodoMVC's Backbone.js example. (All credits to the authors.) It shows how the MV* pattern is applied in Backbone.js.

The original persistance layer (backbone-local-storage) has been replaced to use the REST-Interface defined in the aye_aye-foxx. This was easily archived by adding an url function to all models and collections and removing the backbone-local-storage.

Backend

The backend is a Foxx application written for ArangoDB. It consists of five parts:

Manifest

The manifest is a general description of the Foxx application, including name and version. Also it defines the location of all files, including the assets to build the frontend.

Setup

This script is executed whenever the aye_aye is mounted to a path. It creates the collection for our ToDos.

Teardown

This script is executed whenever a the aye_aye is uninstalled from a path. It drops the collection of ToDos.

Models

Define the models that are executed within the Arango. The todos model offers 4 functions:

  • save: Store a new Todo.
  • destroy: Remove the given Todo.
  • list: Give a list of all Todos.
  • update: Overwrite the given Todo.

Libs

Further libraries, but this feature is not used in the aye_aye.

The App

The ayeaye.js defines the REST interface. At first it requires the todo-model and creates a new Foxx. Then it defines the offered REST functions:

  • /todo GET: Invokes todos.list
  • /todo POST: Invokes todos.save
  • /todo/:id PUT: Invokes todos.update
  • /todo/:id DELETE: Invokes todo.destroy

Installation

After installing ArangoDB, start your server and point it to the location of the cloned repository:

$ ./bin/arangod --javascript.dev-app-path /path/to/aye_aye /path/to/your/arango_db

Then start your Arango shell ($ ./bin/arango) and run the following commands:

arangosh> aal = require('org/arangodb/aal')
arangosh> aal.installDevApp('aye_aye', '/todo')

In this case, aye_aye gets mounted to '/todo' as main directory (but you can of cause adjust the path to your liking). Point your browser to http://localhost:8529/todo/ to run the application.

License

This code is distributed under the MIT license.

aye_aye's People

Contributors

mchacki avatar fceller avatar fhemberger avatar

Watchers

Sławek Maderak avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.