Cook the spaghetti according to the package instructions. Drain off and set aside.
Heat some olive oil in a nonstick skillet and add in the garlic and diced onion. Heat until the onions are very soft and the garlic is very fragrant. This should take about 5-8 minutes on medium heat.
Once the onions are soft, add in the anchovies and continue to cook for another 5 minutes until the anchovies melt into the onions.
Add in the cherry tomatoes and bring the sauce up to a gentle simmer. Let the sauce simmer for about 10 minutes until the tomatoes have burst and the sauce has thickened.
Stir in the chopped olives and the parsley. Add in the chilli flakes according to your taste and how spicy you like your pasta. I find usually about a teaspoon is enough. Toss with the cooked spaghetti noodles and serve.