Files: 6df421c40b28e10fe7138c1519f7c78ebb52f470 / tmpl / docs / basics / open-a-client.html.js
659 bytesRaw
1 | var page = require('../../page.part') |
2 | var com = require('../../com.part') |
3 | |
4 | module.exports = () => page({ |
5 | section: 'docs', |
6 | tab: 'docs-basics', |
7 | path :'/docs/basics/open-a-client.html', |
8 | content: ` |
9 | <h2>Open a client</h2> |
10 | ${ com.code({ js: jsSnippet }) } |
11 | <p class="next"><a href="/docs/basics/publish-a-message.html">Publish a message</a></p> |
12 | <ul class="see-also"> |
13 | <li><a href="/modules/ssb-client.html">SSB-Client API</a> for config options.</li> |
14 | </ul> |
15 | ` |
16 | }) |
17 | |
18 | var jsSnippet = ` |
19 | var ssbClient = require('ssb-client') |
20 | ssbClient(function (err, sbot) { |
21 | if (err) |
22 | throw err |
23 | |
24 | // sbot is now ready. when done: |
25 | sbot.close() |
26 | })` |
Built with git-ssb-web