Closed twalker closed 5 years ago
This looks good. Very useful! I do remember having some problems with the require cache, but that was years ago. Looks like you've solved that now. And the mock-require package looks good for testing too. One thing - can you please add a small explanation in the README? Then I will merge and publish. Thank you very much.
Fantastic! I've updated the documentation to note the option to use JS config files. I don't know why I didn't think to update the documentation in the first place.
By the way, congratulations to you and this module for the 100th Pull requests from 24 contributors!
Thanks again. I just published v1.1.0 to npm. Wow, 100 PRs and 24 contributors is pretty cool! Big thanks to you and all of the OSS community.
This adds support for
config.js
files in addition to the existingconfig.json
format.JSON can become a little verbose, especially when configuring many routes (
webServices
). JS config files allow the configuration to be organized and, potentially dynamic.The approach taken is to use dynamic
require()
imports rather thanfs.readFileSync
, since require imports bothjs
andjson
files by default.This is similar to PR #74, which looked good. However this PR: takes advantage of ES6 syntax, adds tests, and clears require's module cache for when
/admin/reload
is called.