Skip to content

Rest interface should be abstracted #8

Description

@zethon

Abstract the interface in a way that we could easily add TCP/IP support, Console support, etc.. for example

class HandlerBase
{
};

class RestHandler : public HandlerBase
{
...
};

class ConsoleHandler: public HandlerBase
{
};

Then we would have an AshServer object that stored a vector of HandlerBase objects.

AshServer server;
server.addHandler(std::make_shared<HttpHandler>(port));
auto console = std::make_shared<ConsoleHandler>();
server.addHandler(console);

Then messages could be registered:

server.registerMessage("summary", []() { ... });
server.registerMessage("createtx", ...); // some type of validation object that ensures the params exist

From this we could have Http calls come in the way they currently do but then you could invoke strings messages as well:

console->inoke("createtx toaddress privatekey amount");

Where ConsoleHandler would parse the info and ass it to the

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions