Yes, you can absolutely do that. It is the traditional way of doing so.
It is however important to chose a place where the humidity is not too high, yet also not too low.
If the air is too dry and the temperature too hot, the pasta is likely to crack while drying. And on the other hand, if it is too moist or cold, the fresh pasta will go mouldy and sour before it is able to dry.