In a pot of salted boiling water, add dried spaghetti (or your choice of pasta) and cook according to the package instructions.
While the pasta is cooking, heat olive oil in a pan over medium heat. Toss in the onions and cook for 1 to 2 minutes. Add mushrooms and cook for another 2 minutes.