├── .gitignore
├── README.md
├── collection
├── chatroom
│ ├── app.dpd
│ ├── public
│ │ ├── css
│ │ │ └── bootstrap.min.css
│ │ ├── img
│ │ │ ├── glyphicons-halflings-white.png
│ │ │ └── glyphicons-halflings.png
│ │ ├── index.html
│ │ └── js
│ │ │ ├── chatroom.js
│ │ │ └── lib
│ │ │ └── jquery.js
│ └── resources
│ │ └── messages
│ │ ├── config.json
│ │ ├── delete.js
│ │ ├── post.js
│ │ ├── put.js
│ │ └── validate.js
├── comments-1
│ ├── app.dpd
│ ├── public
│ │ ├── index.html
│ │ └── script.js
│ └── resources
│ │ └── comments
│ │ └── config.json
├── todo-app-angular
│ ├── app.dpd
│ ├── public
│ │ ├── css
│ │ │ └── bootstrap.min.css
│ │ ├── img
│ │ │ ├── glyphicons-halflings-white.png
│ │ │ └── glyphicons-halflings.png
│ │ ├── index.html
│ │ └── js
│ │ │ ├── lib
│ │ │ ├── angular.js
│ │ │ └── jquery.js
│ │ │ └── todo.js
│ └── resources
│ │ └── todos
│ │ └── config.json
├── todo-app-backbone
│ ├── app.dpd
│ ├── public
│ │ ├── css
│ │ │ └── bootstrap.min.css
│ │ ├── img
│ │ │ ├── glyphicons-halflings-white.png
│ │ │ └── glyphicons-halflings.png
│ │ ├── index.html
│ │ └── js
│ │ │ ├── lib
│ │ │ ├── backbone-min.js
│ │ │ ├── jquery.js
│ │ │ └── underscore-min.js
│ │ │ └── todo.js
│ └── resources
│ │ └── todos
│ │ └── config.json
└── todo-app
│ ├── app.dpd
│ ├── public
│ ├── css
│ │ └── bootstrap.min.css
│ ├── img
│ │ ├── glyphicons-halflings-white.png
│ │ └── glyphicons-halflings.png
│ ├── index.html
│ └── js
│ │ ├── lib
│ │ └── jquery.js
│ │ └── todo.js
│ └── resources
│ └── todos
│ └── config.json
├── dpd-event
└── custom-response-example
│ ├── app.dpd
│ ├── node_modules
│ └── dpd-event
│ │ ├── index.js
│ │ └── package.json
│ ├── package.json
│ ├── public
│ └── index.html
│ └── resources
│ ├── custom-users
│ ├── config.json
│ └── get.js
│ └── users
│ └── config.json
└── users
├── login-form
├── app.dpd
├── public
│ ├── css
│ │ └── bootstrap.min.css
│ ├── img
│ │ ├── glyphicons-halflings-white.png
│ │ └── glyphicons-halflings.png
│ ├── index.html
│ ├── js
│ │ └── lib
│ │ │ └── jquery.js
│ ├── register.html
│ └── welcome.html
└── resources
│ └── users
│ └── config.json
└── micro-blog
├── app.dpd
├── public
├── css
│ ├── bootstrap.min.css
│ └── style.css
├── img
│ ├── glyphicons-halflings-white.png
│ └── glyphicons-halflings.png
├── index.html
├── js
│ ├── global.js
│ ├── index.js
│ ├── lib
│ │ ├── angular.js
│ │ └── jquery.js
│ ├── register.js
│ └── user.js
├── partials
│ ├── feed.html
│ └── header.html
├── register.html
└── user.html
└── resources
├── posts
├── config.json
├── post.js
├── put.js
└── validate.js
└── users
├── config.json
├── put.js
└── validate.js
/.gitignore:
--------------------------------------------------------------------------------
1 | lib-cov
2 | *.seed
3 | *.log
4 | *.csv
5 | *.dat
6 | *.out
7 | *.pid
8 | *.gz
9 |
10 | pids
11 | logs
12 | results
13 |
14 | .dpd
15 | data
16 |
17 | npm-debug.log
18 | .DS_Store
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | examples
2 | ========
3 |
4 | ## running
5 |
6 | * Check [deployd's repository](https://github.com/deployd/deployd) for
7 | installation instructions.
8 |
9 | * Run ` dpd ` on any folder below `/collections`, `/users`, or `/dpd-event` and
10 | point your browser to **localhost:2403** to see the apps running, **localhost:2403/dashboard** for the deployd backend.
11 |
--------------------------------------------------------------------------------
/collection/chatroom/app.dpd:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/collection/chatroom/public/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deployd/examples/db2c9b259f02baeaf5f965b8970ffb31c7108d29/collection/chatroom/public/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/collection/chatroom/public/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/deployd/examples/db2c9b259f02baeaf5f965b8970ffb31c7108d29/collection/chatroom/public/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/collection/chatroom/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Deployd Todos
5 |
6 |
15 |
16 |
17 |
18 |
Deployd Chatroom
19 |
22 |
27 |
Open this page in multiple browser windows to see it update in real time!
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/collection/chatroom/public/js/chatroom.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 |
3 | dpd.messages.on('create', function(message) {
4 | renderMessage(message);
5 | });
6 |
7 | dpd.messages.get(function(messages) {
8 | if (messages) {
9 | messages.forEach(function(m) {
10 | renderMessage(m);
11 | });
12 | }
13 | });
14 |
15 | $('#send-btn').click(sendMessage);
16 |
17 | function renderMessage(message) {
18 | var $el = $('');
19 | $el.append('' + message.sender + ': ');
20 | $el.append(message.message);
21 | $el.appendTo('#chatbox');
22 | }
23 |
24 | function sendMessage() {
25 | var sender = $('#screen-name').val();
26 | var message = $('#message').val();
27 | dpd.messages.post({
28 | sender: sender,
29 | message: message
30 | }, function(message, err) {
31 | if (err) {
32 | if (err.message) {
33 | alert(err.message);
34 | } else if (err.errors) {
35 | var errors = "";
36 | if (err.errors.sender) {
37 | errors += err.errors.sender + "\n";
38 | }
39 | if (err.errors.message) {
40 | errors += err.errors.message + "\n";
41 | }
42 | alert(errors);
43 | }
44 | } else {
45 | $('#message').val('');
46 | }
47 | });
48 |
49 | return false;
50 | }
51 |
52 | });
53 |
--------------------------------------------------------------------------------
/collection/chatroom/resources/messages/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "Collection",
3 | "properties": {
4 | "sender": {
5 | "name": "sender",
6 | "type": "string",
7 | "typeLabel": "string",
8 | "required": false,
9 | "id": "sender",
10 | "order": 0
11 | },
12 | "message": {
13 | "name": "message",
14 | "type": "string",
15 | "typeLabel": "string",
16 | "required": false,
17 | "id": "message",
18 | "order": 1
19 | },
20 | "date": {
21 | "name": "date",
22 | "type": "number",
23 | "typeLabel": "number",
24 | "required": false,
25 | "id": "date",
26 | "order": 2
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/collection/chatroom/resources/messages/delete.js:
--------------------------------------------------------------------------------
1 | cancel();
--------------------------------------------------------------------------------
/collection/chatroom/resources/messages/post.js:
--------------------------------------------------------------------------------
1 | this.date = new Date().getTime();
2 |
3 | emit('messages:create', this);
--------------------------------------------------------------------------------
/collection/chatroom/resources/messages/put.js:
--------------------------------------------------------------------------------
1 | cancel();
--------------------------------------------------------------------------------
/collection/chatroom/resources/messages/validate.js:
--------------------------------------------------------------------------------
1 | if (!(this.sender && this.sender.length > 2 && this.sender.length < 50)) {
2 | error('sender', "Screen name must be between 2 and 50 characters");
3 | }
4 |
5 | if (!this.message || this.message.length < 1) {
6 | error('message', "Message is required");
7 | } else if (this.message.length > 100) {
8 | error('message', "Message cannot be more than 100 character");
9 | }
--------------------------------------------------------------------------------
/collection/comments-1/app.dpd:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/collection/comments-1/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Deployd Tutorial
5 |
16 |
17 |
18 |
19 |
21 |
22 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/collection/comments-1/public/script.js:
--------------------------------------------------------------------------------
1 | function showError(error) {
2 | var message = "An error occured";
3 | if (error.message) {
4 | message = error.message;
5 | } else if (error.errors) {
6 | var errors = error.errors;
7 | message = "";
8 | Object.keys(errors).forEach(function(k) {
9 | message += k + ": " + errors[k] + "\n";
10 | });
11 | }
12 |
13 | alert(message);
14 | }
15 |
16 | $(document).ready(function() {
17 |
18 | loadComments();
19 |
20 | $('#refresh-btn').click(loadComments);
21 |
22 | $('#comment-form').submit(function() {
23 | //Get the data from the form
24 | var name = $('#name').val();
25 | var comment = $('#comment').val();
26 |
27 | dpd.comments.post({
28 | name: name,
29 | comment: comment
30 | }, function(comment, error) {
31 | if (error) return showError(error);
32 |
33 | addComment(comment);
34 | $('#name').val('');
35 | $('#comment').val('');
36 | });
37 |
38 | return false;
39 | });
40 |
41 | function loadComments() {
42 | dpd.comments.get(function(comments, error) { //Use dpd.js to send a request to the backend
43 | $('#comments').empty(); //Empty the list
44 | comments.forEach(function(comment) { //Loop through the result
45 | addComment(comment); //Add it to the DOM.
46 | });
47 | });
48 | }
49 |
50 | function addComment(comment) {
51 | var editLink = $('Edit');
52 | var deleteLink = $('Delete');
53 |
54 | var div = $('
' + comment.comment + '
') 58 | .appendTo('#comments'); 59 | 60 | deleteLink.click(function() { 61 | dpd.comments.del(comment.id, function(success, error) { 62 | if (error) return showError(error); 63 | div.remove(); 64 | }); 65 | return false; 66 | }); 67 | 68 | editLink.click(function() { 69 | var newComment = prompt("Enter the new comment text:", comment.comment); 70 | if (newComment) { 71 | dpd.comments.put(comment.id, {comment: newComment}, function(result, error) { 72 | if (error) { return showError(error); } 73 | comment = result; 74 | div.find('p').text(comment.comment); 75 | }); 76 | } 77 | return false; 78 | }); 79 | } 80 | 81 | }); -------------------------------------------------------------------------------- /collection/comments-1/resources/comments/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "type":"Collection", 3 | "properties":{ 4 | "comment":{ 5 | "required":true, 6 | "type":"string", 7 | "typeLabel":"string", 8 | "id":"comment" 9 | }, 10 | "name":{ 11 | "required":false, 12 | "type":"string", 13 | "typeLabel":"string", 14 | "id":"name" 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /collection/todo-app-angular/app.dpd: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /collection/todo-app-angular/public/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deployd/examples/db2c9b259f02baeaf5f965b8970ffb31c7108d29/collection/todo-app-angular/public/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /collection/todo-app-angular/public/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deployd/examples/db2c9b259f02baeaf5f965b8970ffb31c7108d29/collection/todo-app-angular/public/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /collection/todo-app-angular/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Deployd Todos
12 |You don't have any todos! Add one now:
13 |14 |-
15 |
19 |
20 |
21 | 25 |26 | Remove completed items 27 |
28 |Deployd Todos
10 |You don't have any todos! Add one now:
11 |12 |
13 | 17 |18 | Remove completed items 19 |
20 |Deployd Todos
10 |You don't have any todos! Add one now:
11 |12 |
13 | 17 |18 | Remove completed items 19 |
20 |