Skip to content

Add Serving Static Files to Documentation #6

@cama

Description

@cama

Background history

This happens when Facebook sends messages that BotStackJS not yet able to handle correctly. Typically, this is a service message from facebook. In the future we will properly handle.

This is inside the Class BotStack:
this.server.get('/images/', (req, res, next) => {
//res.send(__dirname + '/images')
let serveData = {
directory: './images', -------- I cannot understand where is
the root for this restify function and it just won't serve an html from a
subfolder. I tried for 2 hours different debugging things and couldn't find
it...
file: 'images.html',
}
restify.serveStatic(serveData),
});
Under the hood BotStackJS uses Restify, perhaps you should read the documentation on restify.serveStatic

Usually the root directory is the directory where you run node for execution.

BotStackJS can serve static files for you. All you just need to set 2 environment variables: BOTSTACK_STATIC and BOTSTACK_URL.

For example, you can set this value: BOTSTACK_STATIC=./media
And next create public path inside media (it's Restify issue). After this you can get your files by this URL for example : http://localhost:3000/public/myfile.png

BOTSTACK_URL reserved for future use. You can setup this variable with empty value: BOTSTACK_URL=

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions