I placed the nodeMCU into my locomotive. So the heart (power buffer), the legs (motor amplifier) and the brain (microcontroller) is now imbedded.
For all, who are interrested in the technology: I used the PWM functionality to control the speed. The websocket connection is not only working one way. As a usual webserver, it is possible to connect from several devices to the website. So it is possbile to control the locomotive from several devices in parallel. So I connected to the ESP8266 with my mobile, tablet and laptop in parallel. As soon as I move the speed slider on one of my devices, the slider on all other devices moves as well. Same for the state of the buttons (turned “ON” or “OFF”).