Created
January 27, 2017 20:54
-
-
Save elimence/f179656b8a7a7db7c1fb5b0ae251f351 to your computer and use it in GitHub Desktop.
This file contains 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
class WillService { | |
constructor (options) { | |
this.willData = options.willData | |
} | |
getWill (willId) { | |
return this.willData.getWill(willId) | |
} | |
createWill (data) { | |
return this.willData.create(data) // { title: 'my first will', content: '' } | |
} | |
} | |
function createWillService (options) { | |
return new WillService(options) | |
} | |
export createWillService | |
///////////////////////////////////////////// | |
import createWillService from 'will-service' | |
const options = { | |
willData: {} | |
} | |
const WillService = createWillService(options) | |
app.get('/wills/{id}', WillService.getWill(req.params.id)) | |
app.post('/wills', WillService.createWill(req.body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment