-
Notifications
You must be signed in to change notification settings - Fork 114
Zetta
This is the base module for Zetta. It is accessed by using require('zetta')
in node. This class exposes functionality
for standing up your Zetta server, and linking to the cloud.
-
registry
DeviceRegistry Class - Used to override default DeviceRegistry. See zetta-memory-registry for example. -
peerRegistry
PeerRegistry Class - Used to override default PeerRegistry. See zetta-memory-registry for example. -
tls
Object - Include TLS options to the http/https server exposed by zetta.
var zetta = require('zetta');
var options = {
tls: {
key: fs.readFileSync('./key.pem'),
cert: fs.readFileSync('./cert.pem')
}
};
zetta(options)
.listen(443)
-
name
String
Give your zetta instance a human readable name. This will be exposed in the API using the name
property.
var zetta = require('zetta');
zetta()
.name('detroit');
Suppress logging messages.
var zetta = require('zetta');
zetta()
.silent()
-
logFunction
Function
Implement a custom logger for Zetta.
var zetta = require('zetta');
zetta()
.logger(function(log) {
log.on('message', function(level, event, msg, data) {
//Intercept logging messages.
});
})
-
constructor
Function -
[args]
list of arguments -
[options]
Object
Load a device driver into Zetta. These can be custom drivers that you've written, or drivers retrieved from npm.
var zetta = require('zetta');
var arduino = require('arduino');
zetta()
.use(arduino);
-
app
Function - signaturefunction(server){}
Load a zetta app from another module. An app can be a coordination between devices, or a server extension.
var zetta = require('zetta');
var myApp = require('./myapp.js');
zetta()
.use(myApp);
-
host
String or Array of Strings
Link to another Zetta instance. Typically this is used to link your local instance of Zetta to the cloud.
var zetta = require('zetta');
zetta();
.link('http://zettajs.io/cloud');
-
port
Number -
hostname
String -
callback
Function
Select which port your instance of Zetta will listen on locally.
var zetta = require('zetta');
zetta()
.listen(3000, function(err) {
console.log('Server listening on port 3000');
});
Need help? Visit the Zetta Discuss List !
Need help? Visit the Zetta Discuss List ! |
---|
About Zetta
Videos and webcasts
- NEW! Building with Zetta
Tutorials
- NEW! Zetta tutorial series
- Quick start
- Configure a simple device
- Build a mock LED device
- Use the browser client
- Deploy a Zetta server to Heroku
Understanding Zetta
Writing Zetta drivers
- Finding Zetta device drivers
- Create a device driver from starter code
- More coming soon...
Using streams
Reference