To be fair, most web/mobile frameworks expect you to do that.
Ideally, codebases would grow by adding data (e.g. a json describing endpoints, UIs, etc), not repetitive code.
Be very careful with this approach. there are many ways it can go completely wrong. i've seen a codebase like this and it was a disaster to debug. because you can't set breakpoints in data. it was a disaster.
It may not look compact or elegant but I'd rather see debuggable and comprehensible boiler point even if it's repetitive rather than a mess