https://github.com/dplaton/spark-fortune
Small "fortune cookie" service based on the Spark micro-framework
https://github.com/dplaton/spark-fortune
Last synced: 9 months ago
JSON representation
Small "fortune cookie" service based on the Spark micro-framework
- Host: GitHub
- URL: https://github.com/dplaton/spark-fortune
- Owner: dplaton
- Created: 2016-05-12T08:54:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-13T07:20:42.000Z (about 10 years ago)
- Last Synced: 2025-09-06T22:42:32.871Z (10 months ago)
- Language: Java
- Size: 11.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Spark Fortune - A web wrapper for the popular bash program
===
This is a small wrapper around the popular bash command "fortune". This was built in a few hours with the sole purpose of having fun while testing out Spark micro-framework.
## Prerequisites
* Java 8
* Maven
* Fortune (so this won't probably run on Windows)
## Building the source code
To build the source code run a ``mvn clean package`` in the root folder, then a ``java -jar spark-fortune-1.0-jar-with-dependencies.jar`` in the target folder.
## Using docker
You can spawn a [Docker](http://www.docker.com) container using the attached Dockerfile. Just use
```
docker build -t spark-fortune .
```
to build the container (first build will take some time to set up) and then
```
docker run -d -p 4567:4567 spark-fortune
```
to run it.
## Endpoints
### Root endpoint
Does nothing
### Echo endpoint
```
curl -i --data "message=your message here" http://localhost:4567/echo
```
will echo the message back
### Fortune endpoint
```
curl -i http://localhost:4567/fortune
```
Will return a "fortune" message. Use the ``http://localhost:4567/fortune/offensive`` to get the good ones.
##Useful links:
* [Spark Java documentation](http://sparkjava.com/documentation.html)
* [Getting started with Spark and Docker](https://sparktutorials.github.io/2015/04/14/getting-started-with-spark-and-docker.html)