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
import 'dart:convert'; | |
import 'configuration.dart'; | |
import 'package:google_oauth2_client/google_oauth2_console.dart'; | |
import 'package:google_datastore_v1beta2_api/datastore_v1beta2_api_client.dart' as client; | |
import 'package:google_datastore_v1beta2_api/datastore_v1beta2_api_console.dart' as console; | |
/** | |
* Search for args[0] ID in datastore. Add new entity if search fails to locate |
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
$ openssl pkcs12 -in <P12 key> -nocerts -passin pass:notasecret -nodes -out <PEM key> |
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
final Map<String, client.Property> person = | |
{'name' : new client.Property.fromJson({'stringValue' : 'Thomas Løcke'}), | |
'website' : new client.Property.fromJson({'stringValue' : 'http://google.com/+ThomasLøcke'}), | |
'timestamp' : new client.Property.fromJson({'dateTimeValue' : timestamp})}; |
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
library configuration; | |
import 'dart:io'; | |
import 'package:google_datastore_v1beta2_api/datastore_v1beta2_api_console.dart'; | |
class Config { | |
static String get privateKey => new File('privatekey.pem').readAsStringSync(); | |
static const String projectId = 'project-id'; | |
static const String projectNumber = 'project-number'; |
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
console.Datastore getDatastore() { | |
final ComputeOAuth2Console oauthClient = | |
new ComputeOAuth2Console(Config.projectNumber, | |
privateKey : Config.privateKey, | |
iss : Config.serviceEmail, | |
scopes : Config.scopes); | |
return new console.Datastore(oauthClient) | |
..makeAuthRequests = true; | |
} |
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
console.Datastore getDatastore() { | |
final ComputeOAuth2Console oauthClient = | |
new ComputeOAuth2Console(Config.projectNumber); | |
return new console.Datastore(oauthClient) | |
..makeAuthRequests = true; | |
} |
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
import 'dart:io'; | |
import '../lib/routes.dart'; | |
import 'package:shelf/shelf.dart' as shelf; | |
import 'package:shelf/shelf_io.dart' as io; | |
import 'package:shelf_exception_response/exception_response.dart'; | |
void main() { | |
final shelf.Handler handler = const shelf.Pipeline() |
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
name: shelfTest | |
description: Just testing Shelf | |
dependencies: | |
junitconfiguration: any | |
shelf: any | |
shelf_exception_response: any | |
shelf_route: any |
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
library shelftest.routes; | |
import 'handlers.dart' as handler; | |
import 'package:shelf_route/shelf_route.dart'; | |
Router routes = new Router() | |
..get('/user/{userid}', handler.getUser) | |
..put('/user/{userid}/name', handler.setUserName); |
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
library shelftest.handlers; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:io' show HttpHeaders; | |
import 'database.dart'; | |
import 'user.dart'; | |
import 'package:shelf_exception_response/exception.dart'; |
OlderNewer