Permalink
Browse files

added config/after_start.js so you can put code in there that will be…

… run after the server starts listening. Also added a socket.io example app.
  • Loading branch information...
1 parent 46093fd commit 0feb0b22cdbf648ba6d0115c4e8b3d29bb90184a Techwraith committed Jul 1, 2012
@@ -0,0 +1,25 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Application = function () {
+};
+
+exports.Application = Application;
+
+
+
@@ -0,0 +1,30 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Main = function () {
+ this.index = function (req, resp, params) {
+ this.respond(params, {
+ format: 'html'
+ , template: 'app/views/main/index'
+ });
+ };
+};
+
+exports.Main = Main;
+
+
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Geddy App | This app uses Geddy.js</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+
+ <meta name="viewport" content="width=device-width" />
+
+ <!-- The HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <script type="text/javascript" src="/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/js/bootstrap.min.js"></script>
+
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
+ <link rel="stylesheet" href="/css/style.css">
+ <link rel="stylesheet" href="/css/bootstrap.responsive.min.css">
+
+ <!-- The fav and touch icons -->
+ <link rel="shortcut icon" href="/images/favicon.ico">
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+ </head>
+ <body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
+ </a>
+ <a class="brand" href="/">Geddy App</a>
+ <div class="nav-collapse">
+ <ul class="nav">
+ <li class="active"><a href="/">Home</a></li>
+ <li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>
+ <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+ <div class="container">
+ <%- yield(); %>
+ </div>
+ <script src="/socket.io/socket.io.js"></script>
+ <script>
+ var socket = io.connect('http://localhost:4000');
+ socket.on('hello', function (data) {
+ console.log(data);
+ socket.emit('message', "hello from the browser");
+ });
+ </script>
+ </body>
+</html>
@@ -0,0 +1,6 @@
+<!-- Lets talk about geddy -->
+<div class="hero-unit geddy-welcome-box">
+ <h1>Hello, World!</h1>
+ <p>You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...</p>
+ <p><a href="http://geddyjs.org/tutorial.html" class="btn btn-primary btn-large">Lets get you started »</a></p>
+</div>
@@ -0,0 +1,6 @@
+geddy.io.sockets.on('connection', function(socket) {
+ socket.emit('hello', {message: "world"});
+ socket.on('message', function(message) {
+ geddy.log.notice(message);
+ });
+});
@@ -0,0 +1,31 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var config = {
+ detailedErrors: true
+, debug: true
+, hostname: null
+, port: 4000
+, sessions: {
+ store: 'memory'
+ , key: 'sid'
+ , expiry: 14 * 24 * 60 * 60
+ }
+};
+
+module.exports = config;
@@ -0,0 +1,14 @@
+var config = {
+ /*
+ metrics: {
+ port: 4001
+ }
+ */
+
+ socketIo: true
+
+};
+
+module.exports = config;
+
+
@@ -0,0 +1,8 @@
+
+// Add uncaught-exception handler in prod-like environments
+if (geddy.config.environment != 'development') {
+ process.addListener('uncaughtException', function (err) {
+ geddy.log.error(JSON.stringify(err));
+ });
+}
+
@@ -0,0 +1,32 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var config = {
+ detailedErrors: false
+, hostname: null
+, port: 4000
+, sessions: {
+ store: 'memory'
+ , key: 'sid'
+ , expiry: 14 * 24 * 60 * 60
+ }
+};
+
+module.exports = config;
+
+
@@ -0,0 +1,36 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+
+var router = new geddy.RegExpRouter();
+router.match('/').to({controller: 'Main', action: 'index'});
+
+// Basic routes
+// router.match('/moving/pictures/:id').to(
+// {controller: 'Moving', action: 'pictures'});
+// router.match('/farewells/:farewelltype/kings/:kingid').to(
+// {controller: 'Farewells', action: 'kings'});
+// Can also match specific HTTP methods only
+// router.match('/xandadu', 'get').to(
+// {controller: 'Xandadu', action: 'specialHandler'});
+//
+// Resource-based routes
+// router.resource('hemispheres');
+
+exports.router = router;
+
Oops, something went wrong.

0 comments on commit 0feb0b2

Please sign in to comment.