gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com/
MIT License
716 stars 147 forks source link

Is it possible to configure the mime type returned by grunt-contrib-connect? #243

Open Stefany93 opened 5 years ago

Stefany93 commented 5 years ago

I need to serve files without extensions as text/html

Stefany93 commented 5 years ago

SOLUTION:

 options: {
    port: 8800,
    hostname: 'localhost',
        middleware: function(connect, options, middlewares) {
                    middlewares.unshift(function(req, res, next) {
                        res.setHeader('Content-Type', 'text/html');
                        return next();
                    });

                    return middlewares;
                },
  }