RESTHeart version required: 5+ at least.
$ git clone git@github.com:SoftInstigate/restheart-blog-example.git
$ cd restheart-blog-example
$ bower install
Download the latest restheart binary distribution archive, either the tar.gz
or the .zip
file.
Uncompress the downloaded archive, enter the folder and copy the restheart.jar
file and plugins
directory in the blog's main directory restheart-blog-example
Start MongoDB and RESTHeart (refer to RESTHEART documentation for more help)
$ mongod --fork --syslog
$ java -server -jar restheart.jar restheart.yml -e etc/local.properties
The application is available at http://127.0.0.1:8080/blog
The very first time you'll be asked to initialize the database.
This is achieved executing the following curl
commands from command line:
$ curl -u admin:changeit -i -X PUT http://127.0.0.1:8080/data/blog -H "Content-Type: application/json"
$ curl -u admin:changeit -i -X PUT http://127.0.0.1:8080/data/blog/posts -H "Content-Type: application/json"
This is the simplest option. There's a docker-compose.yml which starts both RESTHeart and MongoDB as Docker containers.
$ docker-compose up
The docker
folder contains specific configurations for docker.
You still have to initialize the database. If docker run directly on Localhost (Linux box) then the above curl commands works, otherwise if you are running with docker-machine you'l probably have to change the IP to 192.168.99.100
$ curl -u admin:changeit -i -X PUT http://192.168.99.100:8080/data/blog -H "Content-Type: application/json"
$ curl -u admin:changeit -i -X PUT http://192.168.99.100:8080/data/blog/posts -H "Content-Type: application/json"
Made with ❤️ by The SoftInstigate Team. Follow us on Twitter.