Git Product home page Git Product logo

Comments (4)

jfhbrook avatar jfhbrook commented on August 11, 2024

You can't set headers before using this middleware? Example:

app.use(cors()); // npm view cors
app.use(static); // returned from ecstatic()

from node-ecstatic.

millermedeiros avatar millermedeiros commented on August 11, 2024

uhm, I guess could.. It is just because I'm using http-server and thought it was just a simple wrapper to ecstatic (now I see they also use union...)

I'm still not sure what is the best option (add this setting to ecstatic or to http-server) but feel free to close it if you think it is not necessary, as you said it is pretty easy to inject the headers to the response in any case. - I will need to ask for a pull request on http-server anyway...

Thanks.

from node-ecstatic.

jfhbrook avatar jfhbrook commented on August 11, 2024

Yes, http-server is a wrapper around ecstatic.

I'm not really interested in adding more features to ecstatic itself, though perhaps this would be a useful addition to http-server. Personally, I'd recommend only using the ecstatic/http-server cli tools for testing, and use either a custom server or something like nginx for static assets in production.

from node-ecstatic.

millermedeiros avatar millermedeiros commented on August 11, 2024

yeah, I'm only using it to test things locally that way I don't need to setup apache/nginx for quick stuff... (way easier to start/stop) and as a replacement for python SimpleHTTPServer which is way slower and have some issues w/ multiple consecutive file requests.

I'm trying to run it from a different port/domain that way I can load the static files from my local machine and execute the server-side scripts from a different machine/VM/host as a hack to speed up development on a slow server and load things in parallel (poor man's domain sharding).

opened the issue on http-server (http-party/http-server#43), thanks a lot for the feedback and all the good work.

cheers!

from node-ecstatic.

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.