A Nodejs TypeScript-based Express web server for processing and fetching URLs.
- Node.js application
- TypeScript
- Express.js web server
- URL validation and processing
- Axios HTTP requests
- Req redirect handled by Axios
- Controller and route architecture
- No persistent data storage, all urls stored in memory
- Tested on node version 22.18.0
- Clone the repository
- Install dependencies:
npm install- Clone the repository
- Build and run with Docker Compose:
docker compose up --buildDocker Production:
docker pull leonsm/guards-url-fetch
docker run -p 8080:8080 leonsm/guards-url-fetch -i-
GET /urls- Fetch and process all URLs in the list- Returns processed URL data including content, status codes, and headers
- Handles redirects automatically
- Returns both successful and failed requests
-
POST /urls- Add URLs to the processing listMultiple URLs:
{ "urls": ["http://example1.com", "http://example2.com", "http://example3.com"] }
Add URLs:
curl -X POST -H "Content-Type: application/json" -d '{"urls": ["http://example.com", "http://google.com"]}' http://localhost:8080/urlsFetch and process all URLs:
curl http://localhost:8080/urlsnpm run dev- Start development server with nodemon and hot reloadingnpm run build- Compile TypeScript to JavaScript in dist/ foldernpm start- Start production server from compiled JavaScriptnpm run clean- Remove build directorynpm run test- run tests