Commits

Don Brown  committed 29e16ba

Hello world remote app for heroku

  • Participants
  • Parent commits b48a699

Comments (0)

Files changed (6)

File package.json

     "name": "node-example",
     "version": "0.0.1",
     "dependencies": {
-        "express" : "2.2.0"
+        "express" : "2.2.0",
+        "ejs" : "0.4.3"
     }
 }

File public/atlassian-remote-app.xml

+<remote-app key="heroku-atlassian-app" name="Heroku Remote App" version="1" icon-url="http://heroku.com/favicon.ico"
+            display-url="http://linode.twdata.org/heroku">
+    <vendor name="Atlassian" url="http://atlassian.com" />
+    <description>
+        Heroku integration for associating JIRA projects with Heroku apps
+    </description>
+
+    <!--permissions>
+    </permissions-->
+
+    <entity-type key="app" name="App" pluralized-name="Apps" icon-url="http://heroku.com/favicon.ico"/>
+
+    <admin-page key="herokuAdmin" name="Heroku" url="/admin" />
+
+    <general-page key="herokuApps" name="Heroku Apps" url="/apps"/>
+
+</remote-app>

File views/admin.ejs

+<div>
+    <h2>Admin content</h2>
+</div>

File views/apps.ejs

+<div>    
+<h1>Apps content</h1>
+</div>

File views/layout.ejs

+<html>
+    <head>
+        <script src="<%=baseUrl%>/remoteapps/all.js" type="text/javascript"></script>
+        <link rel="stylesheet" href="<%=baseUrl%>/download/superbatch/css/batch.css" media="all">
+        <link rel="stylesheet" href="<%=baseUrl%>/download/batch/jira.webresources:global-static/jira.webresources:global-static.css" media="all">
+    </head>
+    <body id="jira">
+        <%-body%>
+        <script type="text/javascript">
+            RA.init();
+        </script>
+    </body>
+</html>
 var express = require('express');
 
-var app = express.createServer(express.logger());
+var app = express.createServer(
+        express.logger(),
+        express.static(__dirname + '/public'),
+        express.cookieParser(),
+        express.session({ secret: process.env.SESSION_SECRET || 'mysecret'})
+        );
 
+var baseUrl = "https://remoteapps.jira.com";
 app.get('/', function(request, response) {
-  response.send('Hello World!');
+    response.send('Hello World!');
   });
 
+app.get('/admin', function(request, response) {
+    response.render('admin.ejs', {
+        baseUrl : baseUrl,
+        });
+  });
+app.get('/apps', function(request, response) {
+    response.render('apps.ejs', {
+        baseUrl : baseUrl,
+        });
+    });
+
 var port = process.env.PORT || 3000;
 app.listen(port,function() {
         console.log("Listening on " + port);