Working on the dancer server for NCIP (for doing http (or https with
authorChris Cormack <chrisc@catalyst.net.nz>
Sun, 29 Dec 2013 19:46:07 +0000 (08:46 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Sun, 29 Dec 2013 20:02:58 +0000 (09:02 +1300)
nginx/apache in front)

perl bin/ncip_dancing.pl

And away you go

bin/ncip_dancing.pl [new file with mode: 0755]
config.yml [new file with mode: 0644]
environments/development.yml [new file with mode: 0644]
environments/production.yml [new file with mode: 0644]
lib/NCIP/Dancing.pm [new file with mode: 0644]

diff --git a/bin/ncip_dancing.pl b/bin/ncip_dancing.pl
new file mode 100755 (executable)
index 0000000..86950d2
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/env perl
+use Dancer;
+use NCIP::Dancing;
+dance;
diff --git a/config.yml b/config.yml
new file mode 100644 (file)
index 0000000..e72abad
--- /dev/null
@@ -0,0 +1,28 @@
+# This is the main configuration file of your Dancer app
+# env-related settings should go to environments/$env.yml
+# all the settings in this file will be loaded at Dancer's startup.
+
+# Your application's name
+appname: "NCIP::Dancing"
+
+# The default layout to use for your application (located in
+# views/layouts/main.tt)
+layout: "main"
+
+# when the charset is set to UTF-8 Dancer will handle for you
+# all the magic of encoding and decoding. You should not care
+# about unicode within your app when this setting is set (recommended).
+charset: "UTF-8"
+
+# template engine
+# simple: default and very basic template engine
+# template_toolkit: TT
+
+#template: "simple"
+
+template: "template_toolkit"
+engines:
+   template_toolkit:
+     start_tag: '[%'
+     end_tag:   '%]'
+
diff --git a/environments/development.yml b/environments/development.yml
new file mode 100644 (file)
index 0000000..1107437
--- /dev/null
@@ -0,0 +1,27 @@
+# configuration file for development environment
+
+# the logger engine to use
+# console: log messages to STDOUT (your console where you started the
+#          application server)
+# file:    log message to a file in log/
+logger: "console"
+
+# the log level for this environment
+# core is the lowest, it shows Dancer's core log messages as well as yours
+# (debug, info, warning and error)
+log: "core"
+
+# should Dancer consider warnings as critical errors?
+warnings: 1
+
+# should Dancer show a stacktrace when an error is caught?
+show_errors: 1
+
+# auto_reload is a development and experimental feature
+# you should enable it by yourself if you want it
+# Module::Refresh is needed 
+# 
+# Be aware it's unstable and may cause a memory leak.
+# DO NOT EVER USE THIS FEATURE IN PRODUCTION 
+# OR TINY KITTENS SHALL DIE WITH LOTS OF SUFFERING
+auto_reload: 0
diff --git a/environments/production.yml b/environments/production.yml
new file mode 100644 (file)
index 0000000..86801b4
--- /dev/null
@@ -0,0 +1,17 @@
+# configuration file for production environment
+
+# only log warning and error messsages
+log: "warning"
+
+# log message to a file in logs/
+logger: "file"
+
+# don't consider warnings critical
+warnings: 0
+
+# hide errors 
+show_errors: 0
+
+# cache route resolution for maximum performance
+route_cache: 1
+
diff --git a/lib/NCIP/Dancing.pm b/lib/NCIP/Dancing.pm
new file mode 100644 (file)
index 0000000..0a6192a
--- /dev/null
@@ -0,0 +1,10 @@
+package NCIP::Dancing;
+use Dancer ':syntax';
+
+our $VERSION = '0.1';
+
+get '/' => sub {
+    template 'index';
+};
+
+true;