Giter VIP home page Giter VIP logo

Comments (2)

dougwilson avatar dougwilson commented on May 17, 2024

Hello, and sorry you are having an issue. It should be there. I tried really quick to put together an example app using the code snippet you provided and I was unable to reproduce your issue. Can you either modify the below code and then detail how to call it where it does not return a content-type header, or provide your code fully-runnable code and instructions on how to reproduce? We would be happy to diagnose and address the issue, but just are unable to reproduce with the given information.

var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')

var serve = serveStatic('./public', { index: 'index.html' })

var server = http.createServer(function onRequest (req, res) {
  serve(req, res, finalhandler(req, res))
})

server.listen(3000)
$ ls public/
index.html
$ curl -i http://localhost:3000/
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Wed, 15 Feb 2023 17:01:10 GMT
ETag: W/"0-1865605dec6"
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Date: Wed, 15 Feb 2023 17:02:26 GMT
Connection: keep-alive
Keep-Alive: timeout=5

from serve-static.

giovanni-bertoncelli avatar giovanni-bertoncelli commented on May 17, 2024

Thank you for the quick response @dougwilson , I think I've mistaken with some other static content served by my server.

from serve-static.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.