UNPKG

2.4 kBMarkdownView Raw
1# Americano Cozy
2
3When you want to write [Cozy](http://cozy.io) applications with
4[Americano](https://github.com/frankrousseau/americano), you don't have the
5good helpers to write your models. Here are some that could make your life
6easier, notably about declaring your requests.
7
8## Getting Started
9
10Add americano-cozy to the list of your plugins in the Americano configuration file. Then add it as a dependency of your project:
11
12 npm install americano-cozy -g
13
14
15## Models
16
17Do no think about including JugglingDB and its configuration for Cozy
18anymore, Americano Cozy does the job for you:
19
20
21```coffeescript
22americano = require 'americano-cozy'
23
24module.exports = americano.getModel 'Task',
25 done: Boolean
26 completionDate: Date
27```
28
29## Requests
30
31Describe your Data System requests in a single file:
32
33```coffeescript
34# server/models/requests.coffee
35americano = require 'americano-cozy'
36
37module.exports =
38 task:
39 all: americano.defaultRequests.all
40 analytics:
41 map: (doc) ->
42 if doc.completionDate? and doc.done
43 date = new Date doc.completionDate
44 dateString = "#{date.getFullYear()}-"
45 dateString += "#{date.getMonth() + 1}-#{date.getDate()}"
46 emit dateString, 1
47 reduce: (key, values, rereduce) ->
48 sum values
49```
50
51## What about contributions?
52
53Here is what I would like to do next:
54
55* write tests
56* remove async from the dependency (use recursive functions instead)
57* make Data System URL configurable
58
59I didn't start any development yet, so you're welcome to participate!
60
61## What is Cozy?
62
63![Cozy Logo](https://raw.github.com/mycozycloud/cozy-setup/gh-pages/assets/images/happycloud.png)
64
65[Cozy](http://cozy.io) is a platform that brings all your web services in the
66same private space. With it, your web apps and your devices can share data
67easily, providing you
68with a new experience. You can install Cozy on your own hardware where no one
69profiles you. You install only the applications you want. You can build your
70own one too.
71
72## Community
73
74You can reach the Cozy community via various support:
75
76* IRC #cozycloud on irc.freenode.net
77* Post on our [Forum](https://groups.google.com/forum/?fromgroups#!forum/cozy-cloud)
78* Post issues on the [Github repos](https://github.com/mycozycloud/)
79* Via [Twitter](http://twitter.com/mycozycloud)