When running under Node.js, TiddlyWiki includes a simple HTTP/HTTPS web server that allows you to use it from any browser running on the same machine or over a network.
How It Works
The web server listens for requests coming over the network, and performs the following actions in turn:
- Authentication is the process of identifying the current user. TiddlyWiki supports three types of authentication: Anonymous, Basic and Header
- Authorization is the process of determining which resources may be accessed by a particular user. TiddlyWiki implements a simple scheme whereby read and write access to the wiki can be independently controlled.
- Routing is the process of dispatching the request to the API handler, and returning any required data.
Usage
Anonymous Access
The web server is started with the ListenCommand (which supersedes the older ServerCommand). All the NamedCommandParameters are optional, so the simplest form is:
tiddlywiki mywikifolder --listen
Visit http://127.0.0.1:8080/ to access the wiki. Access is anonymous, so anyone can read or write to the wiki.
This will typically be available only to users on the local machine. For information on how to open the instance to the local network see the Web Server host parameter entry.
Authenticated Access
Adding username and password parameters enforces basic authentication for both reading and writing:
tiddlywiki mywikifolder --listen username=test password=tset
Visiting the wiki will prompt for a username and password, and access is denied if they do not match the provided credentials.
Anonymous Read, Authenticated Write
This example adds the authorization parameters readers and writers to grant read access to anonymous users, but require authentication as "joe" in order to gain write access.
Note that anonymous users can trigger a username/password prompt by visiting the route\login-basic
(eg http://127.0.0.1:8080/login-basic).
tiddlywiki mywikifolder --listen "readers=(anon)" writers=joe username=joe password=bloggs
Note the double quotes that are required for parameters containing special characters.
Arguments
The full list of available optional parameters is:
- admin
- anon-username
- authenticated-user-header
- credentials
- csrf-disable
- debug-level
- host
- password
- path-prefix
- port
- readers
- required-plugins
- root-render-type
- root-serve-type
- root-tiddler
- system-tiddler-render-template
- system-tiddler-render-type
- tiddler-render-template
- tiddler-render-type
- tls-cert
- tls-key
- tls-passphrase
- use-browse-cache
- username
- writers
Guides
Further information on usage of the integrated WebServer: