-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: example app using a single node cluster manual setup
- Loading branch information
1 parent
ebfaae6
commit a213c9d
Showing
4 changed files
with
2,082 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Manual Configuration | ||
|
||
Example single node cluster via manual server configuration | ||
|
||
```bash | ||
$ gnats -D -V | ||
``` | ||
|
||
```bash | ||
$ node index.js | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict' | ||
|
||
const Skyring = require('skyring') | ||
|
||
const server = new Skyring({ | ||
seeds: ['127.0.0.1:3456'] | ||
, node: { | ||
port: 3456 | ||
, host: '127.0.0.1' | ||
, app: 'manual' | ||
} | ||
, nats: { | ||
hosts: ['nats://localhost:4222'] | ||
} | ||
, storage: { | ||
backend: 'memdown' | ||
} | ||
}) | ||
|
||
server.load().listen(3000, (err) => { | ||
console.log('server listening http://0.0.0.0:3000') | ||
}) | ||
|
||
function onSignal() { | ||
server.close(()=>{ | ||
console.log('shutting down'); | ||
}); | ||
} | ||
process.once('SIGINT', onSignal); | ||
process.once('SIGTERM', onSignal); |
Oops, something went wrong.