How the diode acts as a switch?

A diode is made up of a P-Type and an N-Type semiconductor. P-Type has "missing" electrons (in a sense); N-Type has extra electrons (in a sense). This means that if you have current going through the two semiconductors from N-type into P-type, it should be easier than normal to apply the current because there is a potential difference between the N-type and P-type because of their relative "positivity" and "negativity". ...but if you reverse the voltage, then you are going against this potential difference and hence the voltage is impeded, resulting in a 0 current (in theory). This will only happen until the reverse voltage exceeds a threshold ampage, at which point the current will shoot up (in reverse).