Creating web server in TWServer and configuration methods.
This commit is contained in:
parent
a1270d6ca2
commit
b4b04967cc
@ -2,7 +2,8 @@ Class {
|
|||||||
#name : #TWServer,
|
#name : #TWServer,
|
||||||
#superclass : #Object,
|
#superclass : #Object,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'wikis'
|
'wikis',
|
||||||
|
'webServer'
|
||||||
],
|
],
|
||||||
#category : #TiddlyWiki
|
#category : #TiddlyWiki
|
||||||
}
|
}
|
||||||
@ -13,7 +14,8 @@ TWServer class >> new [
|
|||||||
| instance |
|
| instance |
|
||||||
instance := super new.
|
instance := super new.
|
||||||
^ instance
|
^ instance
|
||||||
wikis: Dictionary new
|
wikis: Dictionary new;
|
||||||
|
webServer: TLWebserver new
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -25,6 +27,40 @@ TWServer >> exportTiddlersFrom: aWikiName tagged: aTag into: aFolder [
|
|||||||
^ wiki exportJSONTiddlersTagged: aTag in: aFolder
|
^ wiki exportJSONTiddlersTagged: aTag in: aFolder
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TWServer >> initWikiTagDynamicRoute [
|
||||||
|
|
||||||
|
webServer teapot
|
||||||
|
GET: '/<wiki>/<tag>' -> [ :req | (self exportTiddlersFrom: (req at: #wiki) tagged: (req at: #tag) into: FileLocator temp) contents ];
|
||||||
|
output: #text
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TWServer >> port: aPortInteger [
|
||||||
|
|
||||||
|
webServer configuration: { #port -> aPortInteger };
|
||||||
|
refreshTeapot
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TWServer >> removeAllDynamicRoutes [
|
||||||
|
|
||||||
|
webServer teapot removeAllDynamicRoutes
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TWServer >> startAndBrowse [
|
||||||
|
|
||||||
|
webServer start.
|
||||||
|
webServer teapot browse
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
TWServer >> webServer: aTealightWebServer [
|
||||||
|
|
||||||
|
webServer := aTealightWebServer
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TWServer >> wikiNames [
|
TWServer >> wikiNames [
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user