Skip to content

Neo4j with Elixir, Phoenix and Neo4j.Sips(β) - The Movies Example Application

License

Notifications You must be signed in to change notification settings

phoenix-examples/movies_elixir_phoenix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Movies Example Application

A very simple web application using Neo4j with Elixir, Phoenix and Neo4j.Sips(β).

The Stack

These are the components of our Web Application:

Prerequisites

  • elixir and phoenix
  • a local (or remote) Neo4j graph database server. This demo will connect to a local Neo4j Community Edition server instance available at: http://localhost:7474
  • the demo Movie Database. Open the Neo4j Browser. Then install the Movies dataset with :play movies, click and hit the "Run" button.

Install

$ git clone https://github.com/florinpatrascu/movies_elixir_phoenix
$ cd movies_elixir_phoenix
$ mix do deps.get, deps.compile

Configure the access to your Neo4j server

Edit the config/config.exs and describe the Neo4j server endpoint, example:

config :neo4j_sips, Neo4j,
  url: "http://localhost:7474",
  pool_size: 5,
  max_overflow: 2,
  timeout: 30

If your server requires basic authentication, add this to your config file:

basic_auth: [username: "foo", password: "bar"]

or, if using a token, you can specify it like this:

token_auth: "bmVvNGo6O12kzdA=="

Sample configuration:

config :neo4j_sips, Neo4j,
  url: "http://localhost:7474",
  basic_auth: [username: "foo", password: "bar"],
  pool_size: 5,
  max_overflow: 2,
  timeout: 30

more details and examples, here: Neo4j.Sips

Run

Start the Phoenix server:

$ cd movies_elixir_phoenix
$ mix phoenix.server

Point your browser to: http://localhost:4000, and you'll see something like this:

Oh, oh, and some endpoints, of course :)

# JSON object for single movie with cast
$ curl -H "Accept:application/json" \
  http://localhost:4000/movies/findByTitle?title=The%20Matrix

# list of JSON objects for movie search results
$ curl -H "Accept:application/json" \
  http://localhost:4000/movies/findByTitleContaining?title=matrix

# JSON object for the whole graph viz (nodes, links - arrays)
$ curl -H "Accept:application/json" \
  http://localhost:4000/movies/graph?limit=100

Credits

License

MIT

About

Neo4j with Elixir, Phoenix and Neo4j.Sips(β) - The Movies Example Application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 67.0%
  • HTML 23.4%
  • JavaScript 9.6%