Giter Club home page Giter Club logo

skeleton-java-app's Introduction

Skeleton Java app

A skeleton Java web app with no web framework.

Create Your Own Fork

Fork this project to create a repo under your own GitHub account, so that you can commit and push to it. Then clone the code from your fork onto your machine.

Install Dependencies

Make sure you have a JDK and a Java IDE installed. The skeleton web app is configured as a Maven project, so if you import it in to an IDE (e.g. IntelliJ IDEA) as a Maven project then it should download any dependencies as necessary.

Running Locally

If you open the project in an IDE, you should find a class called WebServer which has a main method. If you run this main method then the web server should start up on your local machine.

Your app should now be running on http://localhost:5000.

Now try the following request in your browser: http://localhost:5000/api?q=Who%20wrote%20Romeo%20and%20Juliet? This should call the code in QueryProcessor.java.

Run the unit tests

The skeleton app comes with a small set of unit tests (see the file QueryProcessorTest), which you can add to as you add functionality. Run the tests using jUnit in your IDE, or from the terminal using Maven.

$ cd skeleton-java-app
$ mvn test

Enabling Travis CI

Log in to https://travis-ci.org using your GitHub account. Click the + or Add New Respository on the left, find your new repository and click the slider to enable builds.

Deploy to Heroku

  1. Manually.

    Download the Heroku CLI and use it to log in.

    Once you've logged in to Heroku and created an app, this will add a generated Heroku Git remote to your local Git repository.

    This adds a Git remote to your local repository so that you can run git push heroku master to deploy it manually by transferring your code to Heroku's Git repo. You should see this if you run:

    git remote -v
    

    Another way to add the remote is to run a command like:

    heroku git:remote -a robbie-spike-horse-bucket
    

    Test your application is deployed at a URL similar to https://robbie-spike-horse-bucket.herokuapp.com

  2. Deploy automatically after a green build

    1. Run heroku auth:token to generate an Heroku authorisation token.

    2. You would encrypt this value with the travis command but if you don't have the Travis CLI installed, use this site (use something like rchatley/skeleton-java-app for the repository field)

    3. Create a deploy section to your travis.yml (see the Travis docs)

    4. Add the encrypted value to the deply section of your travis.yml.

    5. Make a change and push, check the travis log to see if it deploys.

NB. You will likely need to add the app value if your GitHub repo's name doesn't match the Heroku app name.

Your travis.yml should look something like this.

language: java
jdk:
- openjdk8
script: mvn clean verify

deploy:
  provider: heroku
  api_key:
    secure: EPYf4T4U9WfJzHi4/CVp4Eom3PXark9x5fbQ23DGw/bjGxpnqMbqv8=
  app: robbie-spike-horse-bucket

skeleton-java-app's People

Contributors

mcirstea92 avatar rchatley 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.