Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServer; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.Route; import io.vertx.ext.web.Router; import io.vertx.ext.web.client.WebClient; import java.util.concurrent.atomic.AtomicReference; public class NotMigrator { final private static int PORT_TDG = 8181; final private static int PORT_MY = 8080; final private static String HOST = "localhost"; final private static String TOKEN = "9f226286-e0d8-4125-ad43-b123b4e464da"; final private static String TYPE = "application/json;charset=utf-8"; final private static String PATH = "/api/migrate/graphql"; public static void main(String[] args) throws Exception { Vertx vertx = Vertx.vertx(); HttpServer server = vertx.createHttpServer(); Router router = Router.router(vertx); WebClient client = WebClient.create(vertx); router .get(PATH) .respond(ctx -> Future.succeededFuture(new JsonObject().put("hello", "world"))); server.requestHandler(router).listen(8080); } public void get(WebClient client) { client .post(PORT_TDG, HOST, "/graphql") .putHeader("Content-Type", "application/json") .sendJsonObject( new JsonObject() .put("query", "{Book(first: 100) { uuid, book_name, author }}") ) .onSuccess(res -> { if (res.statusCode() == 200 && res.getHeader("content-type").equals(TYPE)) { JsonObject body = res.bodyAsJsonObject(); //объект json } }); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)