forked from cadence/breezewiki
		
	In breezewiki.rkt, start server in thread
This allows inspecting the program state using (enter! "breezewiki.rkt") in the REPL.
This commit is contained in:
		
							parent
							
								
									8754273acf
								
							
						
					
					
						commit
						13c1b0636b
					
				
					 1 changed files with 17 additions and 12 deletions
				
			
		| 
						 | 
					@ -24,15 +24,20 @@
 | 
				
			||||||
  (set-reload-poll-interval! #f))
 | 
					  (set-reload-poll-interval! #f))
 | 
				
			||||||
(reload!)
 | 
					(reload!)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(serve/launch/wait
 | 
					(define ch (make-channel))
 | 
				
			||||||
 #:listen-ip (if (config-true? 'debug) "127.0.0.1" #f)
 | 
					(define (start)
 | 
				
			||||||
 #:port (string->number (config-get 'port))
 | 
					  (serve/launch/wait
 | 
				
			||||||
 (λ (quit)
 | 
					   #:listen-ip (if (config-true? 'debug) "127.0.0.1" #f)
 | 
				
			||||||
   (sequencer:make
 | 
					   #:port (string->number (config-get 'port))
 | 
				
			||||||
    (pathprocedure:make "/" page-home)
 | 
					   (λ (quit)
 | 
				
			||||||
    (pathprocedure:make "/proxy" page-proxy)
 | 
					     (channel-put ch (lambda () (semaphore-post quit)))
 | 
				
			||||||
    (filter:make #rx"^/[a-z-]+/wiki/Category:.+$" (lift:make page-category))
 | 
					     (sequencer:make
 | 
				
			||||||
    (filter:make #rx"^/[a-z-]+/wiki/.+$" (lift:make page-wiki))
 | 
					      (pathprocedure:make "/" page-home)
 | 
				
			||||||
    (filter:make #rx"^/[a-z-]+/search$" (lift:make page-search))
 | 
					      (pathprocedure:make "/proxy" page-proxy)
 | 
				
			||||||
    static-dispatcher
 | 
					      (filter:make #rx"^/[a-z-]+/wiki/Category:.+$" (lift:make page-category))
 | 
				
			||||||
    (lift:make page-not-found))))
 | 
					      (filter:make #rx"^/[a-z-]+/wiki/.+$" (lift:make page-wiki))
 | 
				
			||||||
 | 
					      (filter:make #rx"^/[a-z-]+/search$" (lift:make page-search))
 | 
				
			||||||
 | 
					      static-dispatcher
 | 
				
			||||||
 | 
					      (lift:make page-not-found)))))
 | 
				
			||||||
 | 
					(define server-t (thread start))
 | 
				
			||||||
 | 
					(define quit (channel-get ch))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue