You do not need a middleware… You can just create api endpoints (which are reflected onto a php-script) a very simple way: