Good thinking—a generator is a great investment. The best and safest way to install a generator is using a transfer switch.
A transfer switch is by far the safest and most responsible way to install a generator. Using extension cords can cause electrical damage and fires, both within your home and through the public utility lines. Never plug a generator directly into a wall socket—this can cause backfeeding, which is very dangerous.
First, you’ll want to get a transfer switch installed by a professional. Once you’ve got your power switch ready to go, plug the generator in using a gen cord. Next, start the generator. Then head back inside and switch the breakers in the transfer switch from line to generator. You can then turn on the circuits you want the generator to power.