Is Node.js useful for "classic" style websites? -


i considering using nodejs make non-realtime app. example, website blog, forum, or image boards.

i have read nodejs when used asynchronous jobs. wondering result when used serve lot of static files, big images, css & js files, etc.

is true when sending file (suppose it's 2-3mb), whole server blocked until transfer complete? have read might possible use os's sendfile() syscall job. in case, express support this?

no not true. can send files large (much larger 2-3 mb) without blocking. people complain things blocking node event loop don't know they're doing.

you don't need use express behavior.

that being said, if want file server, there's no reason use nodejs. point apache @ directory, , let fly. why reinvent wheel use new sexy technology, when old faithful fine?

if use node simple http server, may recommend simple command line module.

https://npmjs.org/package/http-server

i haven't looked @ code of module, not optimized large files. let's define large in case, files not cached in memory(whatever means setup). if use case calls more optimization (piping "large" files example) may still have write own module, started quickly, , excellent utility use general development when need serve directory real quick.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -