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
// This bit is important. It detects/adds XMLHttpRequest.sendAsBinary. Without this | |
// you cannot send image data as part of a multipart/form-data encoded request from | |
// Javascript. This implementation depends on Uint8Array, so if the browser doesn't | |
// support either XMLHttpRequest.sendAsBinary or Uint8Array, then you will need to | |
// find yet another way to implement this. (This is left as an exercise for the reader, | |
// but if you do it, please let me know and I'll integrate it.) | |
// from: http://stackoverflow.com/a/5303242/945521 | |
if ( XMLHttpRequest.prototype.sendAsBinary === undefined ) { |
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
npm install groa --save |
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
syntax = "proto3"; | |
package example.foo; | |
service Example1 { | |
rpc Ping(Ping) returns (Pong) {} | |
} | |
message Ping { | |
string content = 1; |
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
const Groa = require('groa'); | |
const app = new Groa(); | |
// Add proto file | |
app.addProto(__dirname + '/example1.proto'); | |
// Add middleware | |
app.use(async (ctx, next) => { |