class Amatista::Base

Overview

This class is used as a base for running amatista apps.

Included Modules

Defined in:

amatista/base.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from module Amatista::Sessions

get_session(key) get_session, has_session? has_session?, remove_session(key) remove_session, send_sessions_to_cookie send_sessions_to_cookie, set_session(key, value) set_session

Instance methods inherited from module Amatista::Helpers

add_cache_control(max_age = 31536000, public = true) add_cache_control, add_etag(resource) add_etag, add_last_modified(resource) add_last_modified, redirect_to(path) redirect_to, remote_ip remote_ip, respond_to(context, body) respond_to, send_data(body, filename, disposition = "attachment") send_data, set_headers set_headers

Class Method Detail

def self.configure(&block) #

Saves the configure options in a global variable

Example:

class Main  Amatista::Base
  configure do |conf|
    conf[:secret_key]          = "secret"
    conf[:database_driver]     = "postgres"
    conf[:database_connection] = ENV["DATABASE_URL"]
  end
end

[View source]

Instance Method Detail

def process_request(request : HTTP::Request) : HTTP::Response #

Returns a response based on the request client.


[View source]
def process_static(path) #

Process static file


[View source]
def run(port, environment = :development) #

Run the server, just needs a port number.


[View source]
def run_forked(port, environment = :development, workers = 8) #

[View source]