Nanoscale avalanche photodiodes for highly sensitive and spatially resolved photon detection