[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[fbot8] Implementing the App server in S8

We will instantiate the (express) server as done in app.js, but with a few changes to do not add complexity of configuration files.

The very first expression you must know is how to save a snapshot. It will make it possible to save your changes in the system.
The server starts from snapshot file named u8.snapshot.js, that is a normal snapshot, but with the javascript function print defined to route the argument to console.log.
The expression to evaluate (in a connected workspace) to save your changes in the server is:
'function print(text) { return console.log(text); }',Snapshot contents outputToFile: 'n8.snapshot.js'


Now we can start implementing the server, inheriting from FBBot class that implement the abstract BOT (webhook) for Facebook Messenger.

Current implementation

Uploaded Image: idea.gifThe implementation is published in the folder of U8 Frameworks for Facebook
See FBBot.st file

Reccomended settings for U8 tools

WorkspaceList := #(
#( 'Save snapshot' ' ''function print(text) { return console.log(text); }'',Snapshot contents outputToFile: ''n8.snapshot.js'' ' )
#( 'FileOut all' 'FBBot fileOut ,AleTestDrive fileOut

' )
#('Start the server' 'AleTestDrive start')
)