Doc updates
This commit is contained in:
parent
9e422bea3e
commit
a9f27183fa
14
README.md
14
README.md
|
@ -5,12 +5,10 @@ v0.0.1
|
||||||
|
|
||||||
slnode install asteroid -g
|
slnode install asteroid -g
|
||||||
|
|
||||||
## Example
|
## Asteroid Modules
|
||||||
|
|
||||||
var asteroid = require('asteroid');
|
- [Asteroid Module Base Class](node_modules/asteroid-module)
|
||||||
var app = asteroid();
|
- [Route](node_modules/route)
|
||||||
|
- [Model Route](node_modules/model-route)
|
||||||
app.use(asteroid.configure());
|
- [Model](node_modules/model)
|
||||||
app.use(asteroid.resources());
|
- [Data Source](node_modules/data-source)
|
||||||
|
|
||||||
app.listen(3000);
|
|
|
@ -1,8 +0,0 @@
|
||||||
var asteroid = require('../../');
|
|
||||||
var app = asteroid();
|
|
||||||
|
|
||||||
app.get('/', function (req, res) {
|
|
||||||
res.send('hello world');
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(3000);
|
|
|
@ -3,13 +3,17 @@ v0.0.1
|
||||||
|
|
||||||
## About
|
## 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.
|
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.
|
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,10 @@
|
||||||
|
|
||||||
## About
|
## 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
|
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).
|
||||||
#### port
|
|
||||||
#### database
|
The inherited class must provide a property `adapter` that points to a [jugglingdb adapter](https://github.com/1602/jugglingdb#jugglingdb-adapters).
|
||||||
#### username
|
|
||||||
#### password
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## About
|
## 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
|
### Options
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue