The App object extends [Express](http://expressjs.com/api.html#express) and supports [Express / Connect middleware](http://expressjs.com/api.html#middleware). See [Express documentation](http://expressjs.com/api.html) for details.
```js
var loopback = require('loopback');
var app = loopback();
app.get('/', function(req, res){
res.send('hello world');
});
app.listen(3000);
```
## Properties
### models
The `app.models` object has properties for all defined models. In the following example the `Product` and `CustomerReceipt` models are accessed using the `models` object.
**NOTE:** you must call `app.boot()` to create the `app.models` object.
// the properties passed to Model.extend(name, properties, options)
"properties": {
"id": {"id": true},
"name": "String",
"zip": "Number",
"address": "String"
}
},
"car": {
"dataSource": "my-db"
"properties": {
"id": {
"type": "String",
"required": true,
"id": true
},
"make": {
"type": "String",
"required": true
},
"model": {
"type": "String",
"required": true
}
}
}
}
```
**Model definition properties**
-`dataSource` - **required** - a string containing the name of the data source definition to attach the `Model` to
-`options` - _optional_ - an object containing `Model` options
-`properties`_optional_ - an object defining the `Model` properties in [LoopBack Definition Language](http://docs.strongloop.com/loopback-datasource-juggler/#loopback-definition-language)
**DataSource definition properties**
-`connector` - **required** - the name of the [connector](#working-with-data-sources-and-connectors)
### model(name, definition)
Define a `Model` and export it for use by remote clients.
**definition**
-`public` - **default: true** attach the `Model` to the app and export its methods to clients
-`dataSource` - **required** the name of the `DataSource` to attach the `Model` to
Example:
```js
// declare a DataSource
app.boot({
dataSources: {
db: {
connector: 'mongodb',
url: 'mongodb://localhost:27015/my-database-name'
}
}
});
// describe a model
var modelDefinition = {dataSource: 'db'};
// create the model
var Product = app.model('product', modelDefinition);