Database Connector for Host-Panel
To install @mosure/host-panel-db-connector
.
Using the Connector
Note, setting the appropriate endpoint/region via AWS.config...
is required before using connector components.
Testing
Run unit tests with npm run test
.
Integration Testing with AWS DynamoDB
Run a local DynamoDB docker image via:
docker run -p 8000:8000 amazon/dynamodb-local
Run integration tests (requires AWS DynamoDB endpoint, default is localhost) with npm run integration -- --endpoint http://localhost:8000
.
Games Connector
Get:
const gamesConnector = new GamesConnector();
gamesConnector.get({
id: 'GAME0'
})
.subscribe((game: Game) => {
// TODO: Use the game
});
Put:
const gamesConnector = new GamesConnector();
gamesConnector.put({
id: 'GAME2',
})
.subscribe((valid: boolean) => {
// TODO: Use the result
});
Update:
const gamesConnector = new GamesConnector();
gamesConnector.update({
id: 'GAME2',
name: 'New Name',
})
.subscribe((valid: boolean) => {
// TODO: Use the result
});
Delete:
const gamesConnector = new GamesConnector();
gamesConnector.delete({
id: 'GAME2',
})
.subscribe((valid: boolean) => {
// TODO: Use the result
});