项目作者: morec-at

项目描述 :
Blog APIs
高级语言: Java
项目地址: git://github.com/morec-at/morecat.git
创建时间: 2015-03-17T13:28:59Z
项目社区:https://github.com/morec-at/morecat

开源协议:

下载


morecat

Blog APIs

Technologies

APIs

// TODO Swagger

Entry(Public)

GET all published(pageable)

  1. curl localhost:8080/entries

GET a published

  1. curl localhost:8080/entries/:yyyy/:MM/:dd/:permalink

Entry(Admin)

GET

POST

  1. $ curl -X POST -H "Content-Type: application/json" -d '{"title":"title1", "permalink":"permalink1", "content":"content1","state":"PUBLIC", "format":"MARKDOWN"}' localhost:8080/admin/entries -v

PUT

  1. $ curl -X PUT -H "Content-Type: application/json" -d '{"title":"updated-title", "content":"updated-content", "permalink":"updated-permalink", "state":"PUBLIC", "format":"HTML"}' localhost:8080/admin/entries/1 -v

DELETE

  1. $ curl -X DELETE localhost:8080/admin/entries/1 -v

Media

GET all(pageable)

  1. $ curl -X GET http://localhost:8080/media

GET

  1. $ curl -X GET http://localhost:8080/media/:uuid/:filename

Media(Admin)

POST

  1. $ curl -X POST -F 'file=@some-media.jpg' http://localhost:8080/admin/media

DELETE

  1. $ curl -X DELETE http://localhost:8080/admin/media/:uuid/:filename

Configuration

GET

  1. $ curl -X GET localhost:8080/configurations

Configuration(Admin)

PUT

  1. $ curl -X PUT -H "Content-Type: application/json" -d '{"blogName" : "updated blog name", "blogDescription" : "updated blog description", "publicity" : true}' localhost:8080/admin/configurations -v

Deployment

Put .env file under docker dir with copying from .env.template and fill out POSTGRES_USER, POSTGRES_PASSWORD.

Install Docker Compose and type the following command.

  1. docker-compose -f docker/docker-compose.yml up -d

Build

  1. ./mvnw clean package

Build Docker Image

  1. ./mvnw clean package docker:build

Setup Environment

Run DB(PostgreSQL)

  1. docker run -it -d \
  2. --name morecat-db \
  3. -e POSTGRES_USER=morecat -e POSTGRES_PASSWORD=morecat \
  4. -v /tmp/pgdata/data:/var/lib/postgresql/data \
  5. -p 5432:5432 \
  6. emag/morecat-db:1.0.0

Connect to DB by using psql

  1. docker run -it --rm \
  2. --link morecat-db:db \
  3. emag/morecat-db:1.0.0 \
  4. sh -c 'exec psql -h "$DB_PORT_5432_TCP_ADDR" -p "$DB_PORT_5432_TCP_PORT" -U morecat'

Run morecat

  1. java \
  2. -Dswarm.morecat.db.host=localhost -Dswarm.morecat.db.port=5432 \
  3. -Dswarm.morecat.db.user=morecat -Dswarm.morecat.db.password=morecat \
  4. -jar target/morecat-swarm.jar

Integration Test

  1. ./mvnw clean verify \
  2. -Dswarm.morecat.db.host=localhost -Dswarm.morecat.db.port=5432 \
  3. -Dswarm.morecat.db.user=morecat -Dswarm.morecat.db.password=morecat