GithubHelp home page GithubHelp logo

superswanz / vertx-social Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 2.0 87 KB

Sample vertx web application to showcase usage of vertx-boot library

License: MIT License

Java 100.00%
vertx vertx-web vertx-microservice-application vertx-backend

vertx-social's Introduction

vertx-social

Sample vertx web application to showcase the usage of vertx-boot library.

Getting Started

Git clone the project on your local machine and import it to your favorite ide.

Prerequisites

For runnning this, you will need

  • Java 1.8
  • Gradle support - In Eclipse editor, goto help -> eclipse marketplace -> search for buildship (buildship gradle integration) and install it.
  • Vertx-Boot library.

Brief

This sample application make use of Vertx-Boot library to expose a rest API /runner/api/ping

  • HttpServerVerticle -> Default verticle from the vertx-boot library. Can be extened for the functionality.
  • MessagingVerticle -> Sample Messaging verticle to send messages (no functionality for now).
  • ServerStatusHandler -> Sample handler to send a "OK" Json response.
  • PingHandler -> Default handler from the vertx-boot library to send a "OK" Json response.

Running the app

For running the app, (IDE used here is IntelliJ)

  • Open appConfig.json file and set the "http_server_port" as per your choice.
  • Once, changes are done in appConfig.json, add/edit Run/Debug Configurations for the project("vertx-social") and set:
    • Main class: com.greyseal.vertx.boot.AppLauncher
    • VM options: -Dlogback.configurationFile=file:../vertx-social/src/main/resources/logback.xml
    • Program arguments: run com.greyseal.vertx.boot.verticle.MainVerticle -conf ../vertx-social/src/main/resources/appConfig.json
    • Environment variables: ENV=dev

After setting the variables, Run/Debug the project. If app starts successfully, then try

Type: GET http://localhost:8080/runner/api/ping
Headers: Content-Type: application/json; Trace-Id: c1d887063c3e492b9951b0479fadddda

Response

{
    "status": "OK"
}

That's it.

Vertx-Social usage

  • Currently added support for LinkedIn/Github apis. To run/debug...

{
  "scopes": [
    "r_basicprofile",
    "r_emailaddress",
    "rw_company_admin",
    "w_share"
  ],
  "redirect_uri": "{redirect_uri}",
  "state": "STATE"
}

Response:

{
   "authorizationURL": "{authorization_url}"
}

Click on Authorization url to get the Authorization code.

{
"code":"{authorization_code}",
"redirect_uri":"{redirect_uri}"
}

Response:

{
   "access_token": "{access_token}",
   "expires_in": 5163999,
   "expires_at": 1561910752077
}

Get the access_token and pass it to the concrete apis

{
"access_token":"{access_token}"
}

Response:

{
   "firstName": "ABC",
   "headline": "Software Engineer",
   "id": "8mAy5C1epf",
   "lastName": "XYZ",
   "siteStandardProfileRequest": {
       "url": "{url}"
   }
}

Try same for Github by updating provider=LINKEDIN t0 provider=GITHUB

Built With

  • Vertx - The web framework used
  • Gradle - Dependency Management

vertx-social's People

Contributors

maystreamer avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.