Sha256: 9818090a4c38f6b0ff3314d6c6f904d2da64a83ab8d916c41665552056eb6b9e

Contents?: true

Size: 917 Bytes

Versions: 4

Compression:

Stored size: 917 Bytes

Contents

module App::App
  extend Waxx::Object
  extend self

  runs(
    default: "js",
    js: {
      desc: "Serve the application javascript files.",
      get: -> (x) { 
        x.res.no_cookies = true
        x << "app = {uid:#{x.usr['id']},cid:#{x.usr['cid']}};\n"
        # Read each file in the list and include it
        %w(usr/usr.js).each{|f|
          x << File.read("#{Waxx/:opts/:base}/app/#{f}") 
        }
        # JS for logged in users
        if x.usr?
          %w().each{|f|
            x << File.read("#{Waxx/:opts/:base}/app/#{f}") 
          }
        end
      }
    },
    ok: {
      desc: "Ping the app to see if it is ok",
      get: -> (x) {
        if x.db.app.exec("select 1+1 as two").first['two'] == 2
          x << 'true'
        else
          x.res.status = 500
          x << false
        end
      }
    },
  )
end

require_relative 'log/app_log'
require_relative 'error/app_error'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
waxx-0.2.0 skel/app/app/app.rb
waxx-0.1.4 skel/app/app/app.rb
waxx-0.1.3 skel/app/app/app.rb
waxx-0.1.2 skel/app/app/app.rb