+
Skip to content
This repository was archived by the owner on Jul 25, 2021. It is now read-only.

morec-at/morecat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

morecat

Blog APIs

Technologies

APIs

// TODO Swagger

Entry(Public)

GET all published(pageable)

curl localhost:8080/entries

GET a published

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

Entry(Admin)

GET

POST

$ 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

$ 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

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

Media

GET all(pageable)

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

GET

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

Media(Admin)

POST

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

DELETE

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

Configuration

GET

$ curl -X GET localhost:8080/configurations

Configuration(Admin)

PUT

$ 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.

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

Build

./mvnw clean package

Build Docker Image

./mvnw clean package docker:build

Setup Environment

Run DB(PostgreSQL)

docker run -it -d \
  --name morecat-db \
  -e POSTGRES_USER=morecat -e POSTGRES_PASSWORD=morecat \
  -v /tmp/pgdata/data:/var/lib/postgresql/data \
  -p 5432:5432 \
  emag/morecat-db:1.0.0

Connect to DB by using psql

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

Run morecat

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

Integration Test

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

About

Blog APIs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载