LinkForge Full-stack JavaScript API

URL SHORTENER MICROSERVICE

Turn a full URL into a numeric short link.

This is an original project implementing the API routes required by the freeCodeCamp Back End Development and APIs certification.

POST /api/shorturl GET /api/shorturl/:id
01

Create a short URL

Enter a complete URL beginning with http:// or https://.

02

Expected API contract

The response keys and redirect route match the certification tests.

{
  "original_url": "https://freecodecamp.org/",
  "short_url": 1
}

Invalid input

{ "error": "invalid url" }

Implementation checklist

✓ Original project homepage ✓ URL-encoded body parsing ✓ JSON body parsing ✓ HTTP/HTTPS validation ✓ DNS verification ✓ Numeric short URLs ✓ HTTP 302 redirect ✓ CORS enabled