1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Add examples

This commit is contained in:
Asim Aslam
2020-12-26 15:17:20 +00:00
parent 273bab5dd7
commit a34c70de0e
320 changed files with 20803 additions and 0 deletions

View File

@ -0,0 +1,28 @@
from flask import Flask, request
from werkzeug.serving import run_simple
import uuid
import proxy
service = {
"name": "go.micro.srv.greeter",
"nodes": [{
"id": "go.micro.srv.greeter-" + str(uuid.uuid4()),
"address": "127.0.0.1",
"port": 4000,
}],
}
app = Flask(__name__)
@app.route('/greeter', methods=['POST'])
def hello_world():
name = request.values['name']
if len(name) == 0:
name = 'World'
return 'Hello ' + name + '!'
if __name__ == '__main__':
proxy.register(service)
run_simple('localhost', 4000, app)
proxy.deregister(service)