Router class allows for managing routes as well as acting as a top-wrapper on the HttpUnit.
More...
#include <router.h>
Router class allows for managing routes as well as acting as a top-wrapper on the HttpUnit.
◆ Router()
mantis::Router::Router |
( |
| ) |
|
|
explicit |
◆ ~Router()
mantis::Router::~Router |
( |
| ) |
|
|
default |
◆ addRoute()
json mantis::Router::addRoute |
( |
const std::string & |
table | ) |
|
Restart the HTTP server.
Adds a new table route passed on a given table name. Used mostly when a table is added after the server is already running. The table has to be existing for routes to be created for.
- Parameters
-
- Returns
- JSON object having
success
and error
values.
◆ close()
void mantis::Router::close |
( |
| ) |
|
◆ initialize()
bool mantis::Router::initialize |
( |
| ) |
|
Initialize the router instance creating tables and admin routes.
◆ listen()
bool mantis::Router::listen |
( |
| ) |
const |
Bind to a port and start listening for new connections. Calls
- See also
- HttpUnit::listen() under the hood.
◆ removeRoute()
json mantis::Router::removeRoute |
( |
const json & |
table_data = json::object() | ) |
|
Remove existing route(s), maybe due to deletion of a table.
- Parameters
-
table_data | must have the deleted table's name and type . |
- Returns
- JSON object having
success
and error
values.
◆ updateRoute()
json mantis::Router::updateRoute |
( |
const json & |
table_data = json::object() | ) |
|
Update existing route, probably due to a change in table name and/or table type
- Parameters
-
table_data | Contains the changes, that is, old_type , old_name and new_name matching the old table name and type together with the new table name. The new table type will be fetched from the db. |
- Returns
- JSON object having
success
and error
values.
◆ updateRouteCache()
mantis::json mantis::Router::updateRouteCache |
( |
const json & |
table_data = json::object() | ) |
|
Update existing route internal data, probably due to a change in table internal metadata
- Parameters
-
table_data | Contains the new table schema |
- Returns
- JSON object having
success
and error
values.
◆ __class_name__
const std::string mantis::Router::__class_name__ = "mantis::Router" |
The documentation for this class was generated from the following files:
- /home/runner/work/mantis/mantis/include/mantis/core/router.h
- /home/runner/work/mantis/mantis/src/core/router.cpp