How deepanshuu2002/short-url works
This is a small Express URL-shortening service. A client submits a URL to create a short ID; a request using that ID records a visit and redirects to the original URL. A separate analytics endpoint returns the visit count and history. The implementation separates HTTP routing, request handling, and the Mongoose URL model. The excerpts show the MongoDB connection setup and model operations; no README or further product capabilities were provided.
Main entry points: controllers/url.js URL handlers · index.js Express app · routes/url.js Create and analytics routes · getUrl.js Redirect route
Components 8
HTTP interface
- Express app
index.js - Create and analytics routes
routes/url.js - Redirect route
routes/getUrl.js
URL handling
- URL handlers
controllers/url.js
Persistence
- URL model
models/url.js - MongoDB connection
connect.js
Other components
- HTTP client
- MongoDB
Connections 10
- HTTP client → Express app: sends requests
- Express app → Create and analytics routes: mounts at /url
index.js - Express app → Redirect route: mounts at /
index.js - Express app → MongoDB connection: connects on startup
index.js - MongoDB connection → MongoDB: connects
connect.js - Create and analytics routes → URL handlers: dispatches
routes/url.js - Redirect route → URL handlers: dispatches
routes/getUrl.js - URL handlers → URL model: creates and queries
controllers/url.js - URL handlers → MongoDB: reads and writes
controllers/url.js - URL handlers → HTTP client: redirects or responds
controllers/url.js