Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6954341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:35:36+00:00 2026-05-27T14:35:36+00:00

I am writing HTTP server on top of Node.js, without using HTTP module. Retrieving

  • 0

I am writing HTTP server on top of Node.js, without using HTTP module.

Retrieving a GET message: GET /www/index.html HTTP/1.1 should send a response with the file located at /www/index.html, same with images and other files.

Could anyone guide me to a javascript way to fetch the files from disk and add them to my HTTP response ?

My server should be able to support the following content types :

  1. JavaScript: application/javascript
  2. HTML: text/html
  3. CSS: text/css
  4. JPEG: image/jpeg
  5. GIF: image/gif
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:35:37+00:00Added an answer on May 27, 2026 at 2:35 pm

    I think the fs module is what you are looking for.

    It provides various function to open and read from files. A simple example :

    fs.readFile('/etc/passwd', function (err, data) {
      if (err) throw err;
      console.log(data);
    });
    

    You can also consult this blog post about reading files with Node : Different ways to read in files using node.js

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing an HTTP simple server on top of Net node.js module, not using HTTP
I am writing a basic http server in C. Handling a simple static .html
I'm writing an automation script with autoit: http://www.autoitscript.com/autoit3/index.shtml . In the process I need
I'm writing a simple HTTP server which should play nicely with most clients, but
To learn c++11 (and boost) I am writing a simple http-server using boost asio
I'm writing a cross-platform server program in C++ using Boost.Asio. Following the HTTP Server
I am using express with node.js for a http server. I store the response
I am looking into writing a self contained http server using Qt libraries, although
I'm writing a tiny HTTP server using C++ (just for fun). When receiving request
I'm writing http session manager (gen_server based). That server creates and removes session from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.