Last active
June 12, 2018 13:54
-
-
Save saibotsivad/d2f94d60e6d678457da500f567f2763b to your computer and use it in GitHub Desktop.
just thinking about how to make a demo that uses a client database
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
export default mediator => { | |
mediator.provide('game/get-single', ({ gameId }) => { | |
return mediator.call('database', `SELECT * FROM game WHERE game.id = ${gameId}`) | |
}) | |
} |
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
export default mediator => { | |
mediator.provide('game/get-single', ({ gameId }) => mediator.call('api/get', { | |
url: `/api/secure/games/${gameId}` | |
})) | |
} |
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
export default mediator => { | |
const route = express.Route() | |
route.get('/api/secure/games/:gameId', req => mediator.call('game/get-single', { | |
gameId: req.params.gameId | |
})) | |
return route | |
} |
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
import databaseDataProvider from './database-data-provider' | |
import expressProvider from './express-provider' | |
import database from 'some-filesystem-database' | |
import mannish from 'mannish' | |
import express from 'express' | |
const mediator = mannish() | |
const app = express() | |
mediator.provide('database', database()) | |
databaseDataProvider(mediator) | |
app.use(expressProvider(mediator)) |
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
import apiDataProvider from './database-data-provider' | |
import appInterface from 'my-cool-interface' | |
import mannish from 'mannish' | |
const mediator = mannish() | |
apiDataProvider(mediator) | |
appInterface(mediator) |
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
import databaseDataProvider from './database-data-provider' | |
import database from 'some-browser-database' | |
import appInterface from 'my-cool-interface' | |
import demoData from 'my-cool-interface-demo-data' | |
import mannish from 'mannish' | |
const mediator = mannish() | |
mediator.provide('database', database(demoData)) | |
databaseDataProvider(mediator) | |
appInterface(mediator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment