Last active
May 22, 2018 21:01
-
-
Save graphicbeacon/a16f8484103489b7cb07b7768ea3039b to your computer and use it in GitHub Desktop.
Sample code for "Building RESTful Web APIs with Dart, Aqueduct and PostgreSQL (Part 3)" post on Medium (2)
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 FaveReadsSink extends RequestSink { | |
FaveReadsSink(ApplicationConfiguration appConfig) : super(appConfig) { | |
logger.onRecord.listen( | |
(rec) => print("$rec ${rec.error ?? ""} ${rec.stackTrace ?? ""}")); | |
var managedDataModel = new ManagedDataModel.fromCurrentMirrorSystem(); // load our models | |
var persistentStore = new PostgreSQLPersistentStore.fromConnectionInfo( | |
"dartuser", "dbpass123", "localhost", 5432, "fave_reads"); // configure the db connection | |
ManagedContext.defaultContext = new ManagedContext(managedDataModel, persistentStore); | |
} | |
// ... | |
// ...remaining logic | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment