Default server shared with the one serving MiniDocs.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-30 18:06:16 -05:00
parent a8d12ec46f
commit 2d811e9f38
3 changed files with 13 additions and 6 deletions

View File

@ -4,7 +4,7 @@ Class {
#instVars : [ #instVars : [
'name', 'name',
'folder', 'folder',
'server', 'host',
'componets' 'componets'
], ],
#category : #Brea #category : #Brea
@ -77,8 +77,9 @@ BreaApp >> folder: aFileDirectory [
{ #category : #accessing } { #category : #accessing }
BreaApp >> launch [ BreaApp >> launch [
| defaultRoute | | defaultRoute |
defaultRoute := 'http://localhost:',self server server port asString, '/', self appName. defaultRoute := 'http://localhost:',self webHost server port asString, '/', self appName.
self server GET: self appName -> [ self defaultView ]. self webHost
GET: self appName -> [ self defaultView ].
GoogleChrome openWindowOn: defaultRoute GoogleChrome openWindowOn: defaultRoute
] ]
@ -98,6 +99,6 @@ BreaApp >> parentFolder: anObject [
] ]
{ #category : #accessing } { #category : #accessing }
BreaApp >> server [ BreaApp >> webHost [
^ server ifNil: [ server := MiniDocsServer singleton ] ^ host ifNil: [ host := Teapot allInstances detect: [ :each | each webHost isRunning ]]
] ]

View File

@ -2,5 +2,5 @@ Extension { #name : #String }
{ #category : #'*Brea' } { #category : #'*Brea' }
String >> webView [ String >> webView [
^ Pandoc htmlStringToMarkdown: self ^ (Pandoc htmlStringToMarkdown: self) accentedCharactersCorrection
] ]

View File

@ -0,0 +1,6 @@
Extension { #name : #Teapot }
{ #category : #'*Brea' }
Teapot >> dynamicRoutes [
^ dynamicRouter routes
]