Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add application skeleton

  • Loading branch information...
commit 405f806c436bc185faeaf70659e36ef3d518031b 1 parent ccc8d48
@yssk22 authored
View
7 skeletons/app/_attachments/css/myapp.css
@@ -0,0 +1,7 @@
+/**
+ * myapp.less
+ *
+ * When myapp.css is requested via HTTP, this file is compiled to pure css style, which
+ * is responded to the client.
+ *
+ */
View
8 skeletons/app/_attachments/css/myapp.less
@@ -0,0 +1,8 @@
+/**
+ * myapp.less
+ *
+ * When myapp.css is requested via HTTP, this file is compiled to pure css style, which
+ * is responded to the client.
+ *
+ */
+
View
3  skeletons/app/_attachments/js/myapp.js
@@ -0,0 +1,3 @@
+/**
+ * myapp.js
+ */
View
3  skeletons/app/_attachments/messages/en.json
@@ -0,0 +1,3 @@
+{
+ "myapp.helloworld": "Hello World!"
+}
View
9 skeletons/app/_attachments/templates/index.ejs
@@ -0,0 +1,9 @@
+<% title('My App') %>
+<% css('css/myapp.css') %>
+<% js('js/myapp.js') %>
+<div class="my_app">
+ <h2>My Application</h2>
+ <p>
+ <%= _("myapp.helloworld") %>
+ </p>
+</div>
View
28 skeletons/app/app.js
@@ -0,0 +1,28 @@
+var path = require('path');
+var couchapp = require('couchapp');
+var ddoc = {
+ _id: "_design/myapp" ,
+ version: require('sunrise').version,
+ name: 'MyApp',
+ description: 'my application description',
+ author: 'My Name',
+ views: {},
+ shows: {},
+ lists: {}
+};
+
+module.exports = ddoc;
+
+ddoc.helpers = require('./helpers');
+ddoc.dynamicHelpers = require('./dynamicHelpers');
+ddoc.init = function(app){
+ app.get('/',
+ function(req, res, next){
+ res.render('index.ejs');
+ });
+
+ app.helpers(ddoc.helpers(app));
+ app.dynamicHelpers(ddoc.dynamicHelpers(app));
+};
+
+couchapp.loadAttachments(ddoc, path.join(__dirname, '_attachments'));
View
10 skeletons/app/dynamicHelpers.js
@@ -0,0 +1,10 @@
+/**
+ * You can define dynamic helper functons in this script.
+ */
+module.exports = function(app){
+ return {
+ hello: function(req, res){
+ return "Hello World!";
+ }
+ };
+}
View
10 skeletons/app/helpers.js
@@ -0,0 +1,10 @@
+/**
+ * You can define helper functons in this script.
+ */
+module.exports = function(app){
+ return {
+ hello: function(){
+ return "Hello World";
+ }
+ };
+}
Please sign in to comment.
Something went wrong with that request. Please try again.