On Friday, January 16, 2015 at 5:59:01 AM UTC+1, RichShumaker wrote: > > Since we do everything inside the TiddlyWiki I was just building the > Server Side using it. >
Tiddlywiki on the server is something different than TW on the client. > So you create a Tiddler lets call it 'Connect' and that Tiddler is on both > sides Host and Server and it handles the connections to the server, like a > port to the outside world. > Not sure if this makes any sense but I hope it does. > The problem is, that the web doesn't work that way, partly because of security restrictions. There is no secure direct way to write to the "Connect" tiddler on the server from the client. Since the server can't trust the client. There is always someone in between. .. The server software! When a browser connects to a server the "HTTP://" protocol is used. This protocol has several commands [1]. eg: GET, POST, PUT, DELETE So if you connect to http://tiddlywiki.com the browser actually says to tiddlywiki.com -> GET / ... which means give me the default page. default would be index.* The server software (apache, nginx, tw-nodejs, express.js, ...) has a configuration, that tells it what to do if it gets a "GET /" request. If the address you request doesn't exist you get an error message / page from the server eg: http://tiddlywiki.com/hugo gives 404 page POST and PUT can send data to the server DELETE can delete stuff from the server. ... Depending on the address sent and the access rights of the user you'll get an OK or ERROR message back from the server Since the server only understands those basic commands, the TW client needs a plugin that knows how to read and send information to the server. We have the TiddlyWeb plugin. Exactly it is tiddlywebadaptor.js [2]. The code is *not *important for this description but if you search for POST, PUT, GET you'll see it is handled there. The node js server also needs to know what to do with all these GETs, PUTs and DELETs [3] ... If you go down some lines you'll see code like this: this.server.addRoute({ method: "DELETE", path: /^\/bags\/default\/tiddlers\/(.+)$/, ...... Which tells the server program what to do if there is a DELETE command for address http://tiddlywiki.com/bags/default/anyName ... Those route definitions are called an API (Application Programming Interface). In case of a web program API you'll here RESTful API [5] a lot. So this is a very very basic intro to the "TiddlyWeb API" :) So express.js is a frameworks, that allows you to "simplify" the creation of your own API. If a programmer has already done a lot of express programming, imo it would be easy for them to define the API. ... but if they don't know TiddlyWiki / TiddlyWeb ... it's everything else than "simple" ;) hope that clarifies some things have fun! mario [1] http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods [2] https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js [3] https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/commands/server.js#L128 [4] https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/commands/server.js#L156 [5] http://en.wikipedia.org/wiki/Representational_state_transfer -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywikidev. For more options, visit https://groups.google.com/d/optout.
