Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
Aluisio Amaral edited this page Mar 6, 2018 · 5 revisions

Summary

Use snake_case on retrieved properties

In case you are using the snake_case pattern for your development workflow, you can change the way routeros-client parses the routerOS dashed properties by invoking the useSnakeCase() method of the client object:

useSnakeCase(): void

routeros.connect().then((client) => {
    
    // Changing to snake_case pattern
    client.useSnakeCase();

}).catch((err) => {
    // Error when trying to connect
    console.log(err);
});

Note: you can use snake_case anywhere you wan't, like:

client.menu("/ip proxy access").select([
    "id",
    "dst_host",
    "dst_port",
    "comment"
]).where({
    local_port: 8080
}).get();

Considerations

This library doesn't directly deal with communications with the routerOS, all of that is node-routeros's job. This library is only a big wrapper for common commands of the routerOS through the api.

As stated before, this library is intended to use on the server-side with NodeJS, it won't work on the client-side since it can't handle network sockets like NodeJS do. If you need interaction with the front-end, you can either use ExpressJS or socket.io for a layer of communication.

Any issues you encounter that is related to the connection, please head to my node-routeros page and open an issue there, it'll be easier to track and fix.

Feel free to do any pull requests for fixes, tests or new features, I'll be happy to improve this lib with your help =].

Clone this wiki locally