Git Product home page Git Product logo

test's Introduction

Introduction

User Problem

User would like to implement a CRUD-API exposed over HTTP.

Description

The purpose of this experience is to demonstrate how a developer can quickly implement a “CRUD” application using the Obsidian platform. The application is using a database to store the managed items. The API has been designed to be simple and intuitive.

The experience is built upon an application to manage fruits. The user experience is delivered using a web page proposing the CRUD operations (create / retrieve / update and delete). The user can also use the service endpoint directly.

While this experience does not showcase a fully-matured RESTful model (level 3), it uses HTTP verbs and status.

Concepts & Architectural Patterns

HTTP API, CRUD, Database

Prerequisites

To get started with this quickstart you'll need the following prerequisites:

Name Description Version
java Java JDK 8
maven Apache Maven 3.2.x
oc OpenShift Client Tools v3.3.x
git Git version management 2.x

Build the Project

The project uses Wildfly Swarm to create and package the service.

Execute the following maven command:

mvn clean install

Launch and test

  1. Run the following command to start the maven goal of WildFlySwarm:

    mvn wildfly-swarm:run
    
  2. If the application launched without error, use the following command to access the web interface to view and modify the data in the database:

    http http://localhost:8080/    
    

OpenShift Online

Login and prepare your openshift account

  1. Go to OpenShift Online to get the token used by the oc client for authentication and project access.

  2. On the oc client, execute the following command to replace MYTOKEN with the one from the Web Console:

    oc login https://api.dev-preview-int.openshift.com --token=MYTOKEN
    

Deploy a Postgres Database to Openshift

  1. Start the PostgreSQL database on Openshift
 oc new-app -e POSTGRESQL_USER=swarm -ePOSTGRESQL_PASSWORD=password -ePOSTGRESQL_DATABASE=fruits openshift/postgresql-92-centos7 --name=my-database

This will create a database pod with the name my-database

Working with a service that exposes the data using a REST interface

  1. Use the Fabric8 Maven Plugin to launch the S2I process on the OpenShift Online machine & start the pod.

    mvn clean fabric8:deploy -Popenshift  -DskipTests
    
  2. Get the route url.

    oc get route/swarm-rest-jdbc
    NAME              HOST/PORT                                          PATH      SERVICE                TERMINATION   LABELS
    swarm-rest-jdbc   <HOST_PORT_ADDRESS>             swarm-rest-jdbc:8080
    
  3. Access the web interface to modify the data in the postgres database.

    http://<HOST_PORT_ADDRESS>/
    

test's People

Contributors

openshift-bot 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.