Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an express HTTP server in Node.js #3

Open
shash369 opened this issue Apr 26, 2024 · 0 comments
Open

Create an express HTTP server in Node.js #3

shash369 opened this issue Apr 26, 2024 · 0 comments
Labels

Comments

@shash369
Copy link
Member

shash369 commented Apr 26, 2024

You need to create an express HTTP server in Node.js which will handle the logic of a file server.

  • Use built in Node.js fs module
    The expected API endpoints are defined below,

    1. GET /files - Returns a list of files present in ./files/ directory
      Response: 200 OK with an array of file names in JSON format.
      Example: GET http://localhost:3000/files
    2. GET /file/:filename - Returns content of given file by name
      Description: Use the filename from the request path parameter to read the file from ./files/ directory
      Response: 200 OK with the file content as the response body if found, or 404 Not Found if not found. Should return
      File not found as text if file is not found
      Example: GET http://localhost:3000/file/example.txt
      - For any other route not defined in the server return 404
@shash369 shash369 changed the title task 2 task 1 Apr 28, 2024
@shash369 shash369 changed the title task 1 Create an express HTTP server in Node.js Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant