Doc updates

This commit is contained in:
Ritchie Martori 2013-04-26 10:10:10 -07:00
parent 9e422bea3e
commit a9f27183fa
5 changed files with 21 additions and 29 deletions

View File

@ -4,13 +4,11 @@ v0.0.1
## Install
slnode install asteroid -g
## Example
var asteroid = require('asteroid');
var app = asteroid();
## Asteroid Modules
app.use(asteroid.configure());
app.use(asteroid.resources());
app.listen(3000);
- [Asteroid Module Base Class](node_modules/asteroid-module)
- [Route](node_modules/route)
- [Model Route](node_modules/model-route)
- [Model](node_modules/model)
- [Data Source](node_modules/data-source)

View File

@ -1,8 +0,0 @@
var asteroid = require('../../');
var app = asteroid();
app.get('/', function (req, res) {
res.send('hello world');
});
app.listen(3000);

View File

@ -3,13 +3,17 @@ v0.0.1
## About
Asteroid applications are a combination of regular Node.js modules and Asteroid modules. Asteroid modules may be initialized using JavaScript or by writing config files.
## Extending Asteroid
The core of asteroid is very lightweight and unopionated. All features are added on as `AsteroidModule`s. This means you can add your own functionality, modify existing functionality, or extend existing functionality by creating your own `AsteroidModule` class.
An `AsteroidModule` is an abstract class that provides a base for all asteroid modules. Its constructor takes an `options` argument provided by a `config.json`. It is also supplied with dependencies it lists on its constructor based on information in the `config.json` file.
## Example
See [model](../model) for an example.
See [resource](../resource) for an example asteroid module.
## AsteroidModule.dependencies
### AsteroidModule.dependencies
An asteroid module may define dependencies on other modules that can be configured in `config.json`. Eg. the [collection](../collection/lib/collection.js) module defines a [model](../model) dependency.
@ -27,7 +31,7 @@ A configuration then must define:
Where `some-model-module` is an existing `model` instance.
## AsteroidModule.options
### AsteroidModule.options
Asteroid Modules may also describe the options they accept. This will validate the configuration and make sure users have supplied required information and in a way that the module can use to construct a working instance.

12
node_modules/data-source/README.md generated vendored
View File

@ -2,12 +2,10 @@
## About
Provides a base class for implementing access to a persistence layer.
A `DataSource` is the base `AsteroidModule` class for all data sources. Data sources provide APIs for reading and writing remote data from databases and various http apis.
### Options
### Creating a custom Data Source
#### hostname
#### port
#### database
#### username
#### password
To create a custom data source you must define a class that inherits from `DataSource`. This class should define all the required options using the [asteroid module option api](../asteroid-module) (eg. host, port, username, etc).
The inherited class must provide a property `adapter` that points to a [jugglingdb adapter](https://github.com/1602/jugglingdb#jugglingdb-adapters).

2
node_modules/model/README.md generated vendored
View File

@ -2,7 +2,7 @@
## About
Provides a schema protected api to a data [store](../store).
A `Model` represents the data of your application. Asteroid `Model`s are mostly used for validating interactions with a [DataSource](../data-source). Usually your models will correspond to a namespace in your data source (database table, http url, etc). The bulk of your application's business logic will be in your `Model` or Node.js scripts that require your model.
### Options