Create a minimal Express.js web service using TypeScript with two endpoints. This exercise tests your understanding of:
HTTP redirect status codes
Routing in Express
TypeScript integration
Real-world testing with curl
- Endpoint 1 β /start
This route must respond to GET requests with a redirect to /destination.
Use a relevant HTTP 3xx status code (e.g., 302 or 307).
Ensure the Location header is properly set to /destination.
- Endpoint 2 β /destination
This route must respond to GET requests with:
{ "message": "You have reached the destination!", "timestamp": "" }
Return status code 200 OK.
Implement this using Express.js with TypeScript.
Start the service on port 3000.
Test your implementation using curl:
First, fetch the /start endpoint without following the redirect. You should see the raw 3xx response and the Location header.
Then, figure out how to make curl follow the redirect and reach /destination, verifying the final payload.