MVP 3. Define objectives
- Explore
- Record for future retry
- Try
Project: S.O.L.I.D F.I.R.S.T
MVP 3. Define objectives
Project: S.O.L.I.D F.I.R.S.T
{"lastUpload":"2018-12-03T10:16:31.161Z","extensionVersion":"v3.1.2"} |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');
Those suck for maintenance and they're ugly.
Desipite everyone said it is easy,I think it is good have some hints for it | |
Clean Javascript solution | |
``` | |
``` | |
[You can see more lesson & hints & test & answer on my github repo](https://github.com/chungchi300/head-first-cracking-the-coding-interview-on-hackerrank/tree/master/__tests__/cracking-the-code-interview) |
//very important,these javascript component is more debuggable then native | |
import fetch from 'isomorphic-fetch'; | |
import FormData from 'form-data'; | |
let formData = new FormData(); | |
formData.append('file',fs.createReadStream('test/api/testMedia.jpg')); | |
//implement your own header function | |
let headers = prepareHeaders(); |
// the whatwg-fetch polyfill installs the fetch() function | |
// on the global object (window or self) | |
// | |
// Return that as the export for use in Webpack, Browserify etc. | |
require('whatwg-fetch'); | |
var globalObject = typeof self === "undefined" ? global : self; | |
module.exports = globalObject.fetch.bind(globalObject); |