Git Product home page Git Product logo

vertx-realworld-example-app's Introduction

vertx-realworld-example-app

Sample aplication to demo a vertx-realworld-example-app for gothinkster. Built with vertx web 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.

Brief

This sample application make use of Vertx-Boot library to expose sample rest APIs for [gothinkster] (gothinkster/realworld#228)

  • HttpServerVerticle -> Default verticle from the vertx-boot library.
  • DatabaseVerticle -> Database verticle to store the data.
  • 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. Also, set "mongo_config".
  • Once, changes are done in appConfig.json, add/edit Run/Debug Configurations for the project("vertx-realworld-example-app") and set:
    • Main class: com.greyseal.vertx.boot.AppLauncher
    • VM options: -Dlogback.configurationFile=file:../vertx-realworld-example-app/src/main/resources/logback.xml
    • Program arguments: run com.greyseal.vertx.boot.verticle.MainVerticle -conf ../vertx-realworld-example-app/src/main/resources/appConfig.json
    • Environment variables: ENV=dev. Make sure to set this variable.

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

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

Response

{
    "status": "OK"
}

That's it.

vertx-realworld-example-app usage

  • Create user without authentication or signup

    Type: POST http://localhost:8080/runner/users
    Headers: Content-Type: application/json; Trace-Id: c1d887063c3e492b9951b0479faddddu
    Request body:
{
 "user": {
   "email": "[email protected]",
   "password": "p",
   "userName": "johnjacob",
   "bio":"S/w",
   "image":"/image"
 }
}

Response:

{
   "id": "5b8cd8a7ad813c83f5cfcba5"
}



  • To perform login or authentication

    Type: POST http://localhost:8080/runner/users
    Headers: Content-Type: application/json; Trace-Id: c1d887063c3e492b9951b0479faddddu
    Request body:
{
 "user": {
   "email": "[email protected]",
   "password": "p"
 }
}

Response:

{
   "email": "[email protected]",
   "userName": "johnjacobs"
}

Response Headers

Authorization → BEARER 8a2d6bdfd56b4a2a87009c1bbdca6c14



  • To perform update to user model. This needs authentication token from the above API response

    Type: PUT http://localhost:8080/runner/users
    Headers: AUTHORIZATION: BEARER 69991c4e2ffd44968e017d1d83e1a9ec Content-Type: application/json; Trace-Id: c1d887063c3e492b9951b0479faddddu
    Request body:
{
 "user": {
   "email": "[email protected]",
   "password": "pa",
   "userName": "johnjacobsd",
   "bio":"acc",
   "image":"/image/ima"
 }
}

Response:

{
   "bio": "acc",
   "image": "/image/ima",
   "userName": "johnjacobsd",
   "updatedBy": {
       "$oid": "5b891df4ad813c331cd8a7ab"
   }
}

Response Headers

Authorization → BEARER 8a2d6bdfd56b4a2a87009c1bbdca6c14



Built With

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

vertx-realworld-example-app's People

Contributors

maystreamer avatar

Watchers

James Cloos 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.