Skip to content

apioo/fusio-worker-javascript

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fusio-Worker-Javascript

A Fusio worker implementation to execute Javascript code. More information about the worker API at: https://www.fusio-project.org/documentation/worker

Example

The following example shows an action written in Javascript which gets data from a database and returns a response

module.exports = function(request, context, connector, response, dispatcher, logger) {

    const connection = connector.getConnection('my_db');

    connection.query('SELECT * FROM app_todo', (err, result) => {
        response.build(200, {}, {
            foo: 'bar',
            result: result
        });
    });

};

Types

This table contains an overview which connection types are implemented and which implementation is used:

Type Implementation
Fusio.Adapter.Sql.Connection.Sql mysql2 / pg
Fusio.Adapter.Sql.Connection.SqlAdvanced mysql2 / pg
Fusio.Adapter.Http.Connection.Http axios
Fusio.Adapter.Mongodb.Connection.MongoDB mongoose
Fusio.Adapter.Elasticsearch.Connection.Elasticsearch @elastic/elasticsearch