43 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Factor
		
	
	
		
		
			
		
	
	
			43 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Factor
		
	
	
|  | IN: furnace.alloy | ||
|  | USING: help.markup help.syntax db multiline ;
 | ||
|  | 
 | ||
|  | HELP: init-furnace-tables | ||
|  | { $description "Initializes database tables used by asides, conversations and session management. This word must be invoked inside a " { $link with-db } " scope." } ;
 | ||
|  | 
 | ||
|  | HELP: <alloy> | ||
|  | { $values { "responder" "a responder" } { "db" db } { "alloy" "an alloy responder" } } | ||
|  | { $description "Wraps the responder with support for asides, conversations, sessions and database persistence." } | ||
|  | { $examples | ||
|  |     "The " { $vocab-link "webapps.counter" } " vocabulary uses an alloy to configure the counter:" | ||
|  |     { $code | ||
|  |         <" : counter-db ( -- db ) "counter.db" <sqlite-db> ;
 | ||
|  | 
 | ||
|  | : run-counter ( -- )
 | ||
|  |     <counter-app> | ||
|  |         counter-db <alloy> | ||
|  |         main-responder set-global
 | ||
|  |     8080 httpd ;"> | ||
|  |     } | ||
|  | } ;
 | ||
|  | 
 | ||
|  | HELP: start-expiring | ||
|  | { $values { "db" db } } | ||
|  | { $description "Starts a timer which expires old session state from the given database." } ;
 | ||
|  | 
 | ||
|  | ARTICLE: "furnace.alloy" "Furnace alloy responder" | ||
|  | "The " { $vocab-link "furnace.alloy" } " vocabulary implements a convenience responder which combines several Furnace features into one easy-to-use wrapper:" | ||
|  | { $list | ||
|  |     { $link "furnace.asides" } | ||
|  |     { $link "furnace.conversations" } | ||
|  |     { $link "furnace.sessions" } | ||
|  |     { $link "furnace.db" } | ||
|  | } | ||
|  | "A word to wrap a responder in an alloy:" | ||
|  | { $subsection <alloy> } | ||
|  | "Initializing database tables for asides, conversations and sessions:" | ||
|  | { $subsection init-furnace-tables } | ||
|  | "Start a timer to expire asides, conversations and sessions:" | ||
|  | { $subsection start-expiring } ;
 | ||
|  | 
 | ||
|  | ABOUT: "furnace.alloy" |