This repo contains % tasks given, Task 1 to 3 have been done in seperate folders for easy checking and checking using test cases Task 4 and 5 had some dependency therefore they are done together Task 5 end point is listed in users controller with method name getSecureResource
The tasks were:
Problem 1: Asynchronous Operations
Create a function that takes in an array of URLs and downloads the contents from each URL using asynchronous methods. Once all downloads are complete, return an array with the downloaded contents in the same order as the URLs.
Problem 2: Error Handling
Design a function that fetches data from an API endpoint. Implement proper error handling to handle various HTTP status codes and network failures. Log appropriate messages for each type of error encountered.
Problem 3: File System Operations
Develop a utility that reads a directory and lists all files with a specific extension (e.g., .txt). Implement this functionality using Node.js's File System module.
Problem 4: Database Interaction
Create a simple REST API endpoint using Express.js that interacts with a database (can be any database of your choice). Implement CRUD operations (Create, Read, Update, Delete) for a specific resource (e.g., users, posts).
Problem 5: Authentication
Implement an authentication middleware using JWT (JSON Web Tokens) in a Node.js application. Create endpoints that require authentication to access specific resources. Ensure proper token validation and handling of expired or invalid tokens.