Preheat the oven to 375ºF (190ºC or 180°C for a fan oven).
Heat the oil in a medium frying pan over medium heat.
Add the onion and sauté for a minute or two.
Add the zucchini and red pepper and sauté until the vegetables are beginning to soften.
Grate in the garlic and add the salt, pepper and basil.
Add the finely chopped red chili if using.
Cook for a couple minutes more, stirring frequently.
Cut a large piece of aluminum foil - or two large pieces if you are cooking 4 cod fillets or 2 cod loins. You need something at least four times the size of your piece of fish. Lay the aluminum foil on a baking tray (or two trays if necessary) and brush with a little oil.
Lay the fish on top of the aluminum foil and gently pile the cooked vegetables on top.
Wrap the foil over the fish, making a parcel and sealing the top and sides.
Bake for about 15 to 18 minutes or until the fish flakes easily with a fork.
Remove from the oven and allow to sit in the foil for about five minutes to rest.
Carefully open the foil packet.
To serve cod loins, cut into 4 serving size pieces.