When building the railroads in the American West, in an already existing town, were the stations built after or before the railroad arrived?

I'm writing a story set in a town where a station is being built in preparation for the arrival of the railroad. But it occurred to me that the railroad might do this once they'd arrived. The station platform and ticket office etc.

Any help greatly appreciated. Thank!
5 answers 5