squeaknode/frontend/client.js
Jonathan Zernik a45c3b62be
Add envoy proxy (#95)
* Add envoy proxy

* Add frontend, still not working

* Open port to frontend

* Fix static html page

* Fix url in client js code, but CORS is still blocked

* Successfully make request from browser to sqkserver through proxy

* Expose ports for sqkserver in docker

* Remove unused frontend files

* Remove duplicate envoy config file
2020-07-19 20:20:34 -07:00

33 lines
1 KiB
JavaScript

/**
*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const {HelloRequest,
HelloReply} = require('./proto/squeak_admin_pb.js');
const {SqueakAdminClient} = require('./proto/squeak_admin_grpc_web_pb.js');
var client = new SqueakAdminClient('http://' + window.location.hostname + ':8080',
null, null);
var request = new HelloRequest();
request.setName('World');
console.log('Testing...');
client.sayHello(request, {}, (err, response) => {
console.log(response.getMessage());
});