[Cuis-dev] starting, stopping, and restarting WebServer
Mark Volkmann
r.mark.volkmann at gmail.com
Tue Sep 24 10:53:02 PDT 2024
Here is a very simple use of the WebServer class that can be installed with
Feature require: 'WebClient'. A fileOut containing this code is attached.
The class name is BasicWebServer and it has the single instance variable
server.
It contains only these instance methods.
initialize
server := WebServer new.
server addService: '/' action: [:req | req send200Response: 'Hello,
World!'].
start
server listenOn: 3000
stop
server stopListener
I can start the web server with:
server := BasicWebServer new.
server start.
Then I can browse localhost:3000 and see "Hello, World!" in the web browser.
I can stop the web server with:
server stop.
But I cannot start it again unless I restart the VM. Can someone please
explain what else I can do to enable restarting the server without needing
to restart the VM?
--
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240924/39bc55dc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BasicWebServer.st
Type: application/octet-stream
Size: 700 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240924/39bc55dc/attachment.obj>
More information about the Cuis-dev
mailing list