API Docs for:
Show:

Hop Module

Defined in: lib/user.js:14

Hop Core module

This is the primary impelementation behind Hop

This module is a rollup of the following modules:

  • Cache
    Implements server-side and client side caching
  • CodeGenerator
    Provides generator functionality for generating client stubs for other languauges Hop can utilize its knowledge of your APIs to generate client side stubs for various languages. This module provides the core functionality for generators in such a way that a new generator can be built with relative ease. * Implemeneted generators can be found under /gen in the Hop root directory ## To use a generator Hop tries to make it easy to generate client side code, to do so we use a command line utilility 'hopjs-gen' To generate client side stubs for android for a specific website: hopjs-gen --url http://localhost:3000/ android --outputDir output/ --package com.foo You might first want to make sure HopJS is installed locally npm install -g hopjs ## Creating a new generator 1. Create a new directory under /gen - the directory will be the name of your generator 2. Create a generator.json (see the android/generator.json for an example) 3. Define some number of templates #### Generators work by: * Asking for any required command line options as defiend in generator.json:demand and generator.json:optional * Fetching an API definition from URL/_hopjs/api.json * Loading any required utility functions as defined in generator.json:required * Determining the type of gernerator as specified by generator.json:generates * If the generator type is 'file' then file pointed to by generator.json:template will be evaluated with { Objects, Models (and options passed in via the commandline ) } * If the generator type is 'dir' then dir pointed to by generator.json:templateDir will be evaluated * Files which have the basename _object will be evaluted one for each defined object with { object (and options passed in via the commandline ) } * Files which have the basename _model will be evaluted one for each defined model with { model (and options passed in via the commandline ) } *generator.json:translatePath can be used for determining how templates get translated into the resulting output directory*
  • Event
  • Job
    Provides generic job functionality
  • Test
    Testing module
  • User
    Provides utility functions and DSL implemenations for Methods and Objects. This class will look at request.session.user as a base implementation to support the Hop.User.* functions. These functions are expected to be overrriden if needed.