This is a repository that implements the following functionalities. It does so in a manner that does not separate concerns out well. But it still works. Submit a pull request if you see any improvements!
- User registration with unique username
- Movie registration with unique name
- Users can rate movies between 0 and 10
- Search for a movie by phrase
docker compose up
PG_HOST
defaults tolocalhost
PG_PORT
defaults to5432
PG_USER
defaults tojustin
PG_DB
defaults tosoc_movies_db
ES_HOST
defaults tolocalhost
ES_PORT
defaults to9200
ES_INDEX
defaults tomovies
(for tests,movies_test
)SERVER_PORT
defaults to8818
API_SECRET
defaults tono_auth
- this is a value that needs to be passed in every request (a placeholder for identifying authenticated clients)
./mvnw clean package
API_SECRET=humpty_dumpty java -cp target/soc-movies-1.0-SNAPSHOT.jar soc.movies.web.Launcher
API_SECRET=humpty_dumpty ./mvnw clean compile exec:java -Dexec.mainClass="soc.movies.web.Launcher"
There is a Swagger page that will provide details about the individual APIs http://localhost:8818/swagger-ui
API_SECRET=humpty_dumpty PG_DB=soc_movies_test_db mvn test
While the server is running, run the following command to create some movies with ratings:
SERVER_PORT=8818 API_SECRET=humpty_dumpty sh src/test/resources/create_soc_movies.sh
curl -H'Content-Type: application/json' localhost:9200/movies/_search -d'{
"query": {
"query_string": {
"query": "family"
}
}
}'