Created
October 31, 2018 12:06
-
-
Save ufocoder/904a3504d55caf0e3fb8dc5a970fd11f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function runAsPromised (task, ...params) { | |
| return new Promise((resolve, reject) => | |
| task(...params, higherOrderNodeCallback(resolve, reject)) | |
| ); | |
| } | |
| runAsPromised(readFile, filePath) | |
| .then(convertToContent) | |
| .then(JSON.stringify) | |
| .then(closeWithContent(res, 200, jsonHeaders)) | |
| .catch(closeWithStatus(res, 404)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment