GithubHelp home page GithubHelp logo

spring-boot-cosmosdb's Introduction

Introduction

This project uses cosmos db SQL container/database. It demonstrates how cosmos db can be used with springboot.

Getting Started

  1. Clone the project to your local.
  2. Create a comsos db account; SQL API based database & container.
    • Database Name : "TMUsers" (This will be added to the application.yml file)
    • URI : Read/Write URI to the cosmosdb account; update in applicaiton.yml
    • Key : Read/Write key to the cosmosdb account; update in application.yml
    • Continer Name : "tmusers" If container is missing, applicaiton will create new container.
  3. Use Build and Test section to build and use for your testing.

Build and Test

  1. Do a maven install

    • Start from root directory of the project
    • use maven to build and install mvn clean install
    • This will create jar file target/demo.jar
    • You can directly run this jar file in java runtime java -jar target/demo.jar
  2. Build docker image

    • If you dont want to run this in docker runtime or in a kubernetes cluster build a docker image.
    • To build docker image use docker build --tag imagename:tag .
    • You can tag this image to be pushed to a repository and use for deploymetn on K8s
    • Use command docker tag imagename:tag repository.domain.com/imagename:tag
    • Push to repository docker push repository.domain.com/imagename:tag
  3. Testing

    • Creating user curl --request POST --header "Content-Type: application/json" --data '{ "firstName":"Ashish", "lastName":"Verma", "id":"127906" }' http://localhost:8080/tmuser

    • Get User by ID curl http://localhost:8080/tmuser/id/{userId}

    • Get User by First Name curl http://localhost:8080/tmuser/firstname/{firstName}

spring-boot-cosmosdb's People

Contributors

vermacodes avatar

Watchers

 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.