forked from FabricLabs/maki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaki.js
87 lines (77 loc) · 2 KB
/
maki.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var config = require('./config');
var Maki = require('./lib/Maki');
var maki = new Maki( config );
var Passport = require('maki-passport-local');
var passport = new Passport({
resource: 'Person'
});
maki.use( passport );
var CMS = require('maki-cms-local');
var cms = new CMS({
base: '/docs',
path: '/docs'
});
var Auth = require('maki-auth-simple');
var auth = new Auth({
resource: 'Person'
});
maki.use(cms);
maki.use(auth);
var Person = maki.define('Person', {
attributes: {
username: { type: String , max: 80 , required: true , slug: true },
name: {
family: { type: String , max: 80 },
given: { type: String , max: 80 }
},
hash: { type: String , restricted: true },
salt: { type: String , restricted: true },
email: { type: String , max: 80 , restricted: true },
created: { type: Date , default: Date.now }
},
auth: {
'patch': ['admin', function(done) {
var person = this;
return false;
}]
},
icon: 'user'
});
Person.post('patch', function(done) {
var person = this;
console.log('person updated:', person);
done();
});
maki.define('Example', {
attributes: {
name: { type: String , max: 80 },
slug: { type: String , max: 80 , id: true },
content: { type: String },
screenshot: { type: 'File' }
},
source: 'data/examples.json',
icon: 'idea'
});
maki.define('Release', {
attributes: {
name: { type: String , max: 80 },
tag: { type: String , max: 80 },
created: { type: Date },
published: { type: Date },
notes: { type: String , render: 'markdown' }
},
source: 'https://api.github.com/repos/martindale/maki/releases',
icon: 'tags',
map: function( release ) {
return {
name: release.name,
tag: release.tag_name,
notes: release.body,
published: new Date( release.published_at )
};
}
});
/*var Analytics = require('maki-analytics');
var analytics = new Analytics({ id: 'UA-57746323-2' });
maki.use( analytics ).serve(['http']).start();*/
maki.start();