macchiato-framework / macchiato-core

Ring style HTTP server abstraction for Node.js
MIT License
377 stars 35 forks source link

https server starts with non existing key and certificate files without any hint that something went wrong #38

Closed nenadalm closed 4 years ago

nenadalm commented 4 years ago

Here is place that reads files: https://github.com/macchiato-framework/macchiato-core/blob/8660c2ffb3ce91dc16b0ebb6e9c56f9c2e36cd31/src/macchiato/server.cljs#L28

but in case of non existent files, it just proceeds silently (https://github.com/macchiato-framework/macchiato-fs/blob/1561f573de04d373aa3ae8b233b25f5f4abc1052/src/macchiato/fs.cljs#L27)

I noticed this on ci, where I've got message that server started, but curl wouldn't return status 200 when checking if started.

Maybe slurp in macchiato-fs should return exception as it does in Clojure? Or macchiato-core should check if files exists?

yogthos commented 4 years ago

Yeah, I think slurp throwing an exception would be the way to go. I'll try take a look soonish, but if you'd be up for doing a PR I can do a new release with it as well.