Use a Shape Layer to create the spline/path. Ensure to switch off the Fill property for the Shape Layer. Apply the Gradient Stroke Shape Operator.
The Gradient Stroke's start and end points can be observed in the Comp Panel as a dashed line with two dots on either end. Move the start and end points accordingly. Set the gradient's start and end color to taste.
Intensive mocha & AE Training in Singapore and Other Dangerous Locations
Imagineer Systems (mocha) Certified Instructor
& Adobe After Effects CS6 ACE