drogonframework / drogonframework/drogon

register a controller after drogon run method

Open
#1,767 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

when we want to register a controller to the framework by parameters we can use registerController method:

https://github.com/drogonframework/drogon/blob/e2e5d6d57f26b79bab83e87d1d3596d077925603/lib/inc/drogon/HttpAppFramework.h#L632

```
class ApiTest : public drogon::HttpController
{
public:
ApiTest(const std::string &str);
...
};
```

when I use this method after `drogon::run() ` for some classes it works and for some other throws an exceptions, is there any safe way to register my controller after calling run method? (e.g. reloading DrClassMap classes, reloading routes, etc?)

aslo in here has been noted that it is not possible:

https://github.com/drogonframework/drogon/blob/e2e5d6d57f26b79bab83e87d1d3596d077925603/lib/inc/drogon/HttpAppFramework.h#L634C1-L635C1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.