Erregistroa posta elektronikoz bidali: Reconfigurable photonics with on-chip single-photon detectors