The melody is informed by the chords, and vice versa.
Don's point is well taken--you can't really have one without the other, in the styles of music we are discussing anyway.
But just because there are right chords and wrong chords to any given song, that doesn't mean there's only one "right" set of chords. The optional nature of the use of relative minors, or sevenths, for example. It also depends on what particular variant of the melody you are using, of course--and what the folks around you are playing!
Also, the chord scale figures heavily in my playing--you can squeeze in lots of chords and make something interesting, as long as they are passing chords (strummed once or twice, as part of a progression) and you know where you are going with them. If you end such a progression on the right chord at the right time, everything else sounds right in retrospect--if you fumble it and go to something else by mistake, you sound like a clown.
'Example: chording for the tune "The Banshee", playing in G, you can play the beginning of the B part like this: (version 1) Am 2 - 3 - 4 - Em. Sounds perfectly fine.
Or you can play (version 2) Am - Bm - C - D - Em. (one beat only on the first 4 chords)
which has considerably more je ne sais quoi...but a good arrangement would be to use the simpler first approach once or twice through and then switch to the second, the chord scale variant, to up the dynamic ante when the listener has been lulled into expecting the version 1 chords.
A song is a bit like a road rally--there are certain checkpoints at which you must arrive, at more or less the exact right time and place. In between the checkpoints there is considerable latitude, but you have to keep the checkpoints in mind.