Git Product home page Git Product logo

spring-sendgrid's Introduction

spring-sendgrid

A sample application for using Spring Framework and SendGrid on Cloud Foundry.

Running the application on Cloud Foundry

After installing in the 'cf' command-line interface for Cloud Foundry, targeting a Cloud Foundry instance, and logging in, the application can be pushed using these commands:

$ ./gradlew assemble
$ cf push --path=build/libs/spring-sendgrid.war

If prompted to create a service for your app, select y and choose the SendGrid service. This will provision an account on SendGrid and bind it to your app, which stores credentials for the account in the VCAP_SERVICES environment variable. This application will read those credentials and use them when it sends e-mails.

The application will be pushed using settings in the provided manifest.yml file. The settings include some random characters in the host to make sure the URL for the app is unique in the Cloud Foundry environment. Once the app is uploaded and finishes staging, run the following command to see the URL that was assigned:

$ cf app
Using manifest file manifest.yml

spring-sendgrid: running
  usage: 512M ร— 1 instance
  urls: spring-sendgrid-7acab.cfapps.io
  services: sendgrid

Using the provided URL in the urls field displayed, you can browse to the running application.

You can see what environment variables are available to the application (including the VCAP_ENVIRONMENT variable) by navigating to http://<app-url>/env.

You can override the SendGrid credentials in the environment by configuring them in the file src/main/resources/application.properties.

Running the application locally

When running locally, the SendGrid credentials must be set manually in the file src/main/resources/application.properties.

After editing the file and adding the credentials, run this command to start the app:

./gradlew tomcatRun

Once the app is running you can browse to the URL http://localhost:8080/spring-sendgrid.

A note on `./gradlew'

The first time ./gradlew runs, it will take a while to download the build tool. Subsequent runs will be much faster.

spring-sendgrid's People

Contributors

ramnivas avatar scottfrederick 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.