/spark-demo

Demonstrate how to use the Spark microframework

Primary LanguageGroovy

Spark Demo

This is a self-contained demonstration of Spark.

Setup

  1. Download and Install Java 8 JDK

  2. Next, add JAVA_HOME to your environment variables:

    'Computer' → 'System properties' → 'Advanced system settings' → 'Environment Variables…​' → 'User variables' → 'New…​'

    Variable name: JAVA_HOME

    Variable value: C:\Program Files\Java\jdk1.8.0_05

  3. Click OK, OK, OK.

  4. Open Git Bash and type:

    cd ~          # Go to your home directory
    git clone https://github.com/lawrancej/spark-demo.git
    cd spark-demo # Go into the folder we just made
    start .       # Open the folder we just created
    ./gradlew run # Run the demo
  5. Open http://localhost:4567 and you should see "Hello, world!" (unless you goofed up a step along the way)

    Note
    Type 'Ctrl-C' in Git Bash to stop the web server.
  6. Open src/main/java/Main.java to see the source code.

Next steps

See more examples of using Spark.