Files: 4e8da600acc3fc799b7e303c1b6c50bb67e7c45a / index.js
679 bytesRaw
1 | var koa = require('koa'); |
2 | var app = koa(); |
3 | var router = require('koa-router')(); |
4 | var avatar = require('ssb-avatar'); |
5 | var views = require('co-views'); |
6 | var client = require('ssb-client') |
7 | |
8 | app.use(router.routes()) |
9 | |
10 | var render = views(__dirname, { ext: 'jade'}); |
11 | var me = '@ya/sq19NPxRza5xtoqi9BilwLZ7HgQjG3QpcTRnGgWs=.ed25519' |
12 | |
13 | router.get('/', function *(next) { |
14 | client(function (err,sbot) { |
15 | if(err) { |
16 | throw err; |
17 | } |
18 | avatar(sbot, me, me, function (err, avatar){ |
19 | if (err) { |
20 | throw err; |
21 | } |
22 | name = avatar.name; |
23 | image = avatar.image; |
24 | }) |
25 | }) |
26 | this.body = yield render('index', {title:'Porthole', name, image}) |
27 | }) |
28 | |
29 | app.listen(3000); |
30 |
Built with git-ssb-web