Giter Site home page Giter Site logo

lina / neo4j-movies-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neo4j-examples/neo4j-movies-template

0.0 1.0 0.0 7.8 MB

This project contains a Node.js starter template for a Neo4j movies dataset.

Home Page: http://neo4jmovies.herokuapp.com

JavaScript 63.81% HTML 13.93% Ruby 3.25% Shell 1.45% CSS 17.56%

neo4j-movies-template's Introduction

This repository is a movie content browser powered by Neo4j. All movie content is consumed from a Neo4j REST API endpoint built using Neo4j Swagger.

##Tools:

Architecture

  • Front-end web-based dashboard in Node.js and Bootstrap
  • REST API via Neo4j Swagger in Node.js
  • Data import services in Node.js
  • Data storage in a Neo4j graph database

Getting Started

If you haven’t done so already, download or clone this repository and navigate to it using your Terminal (if on a Mac) or command line.

Setting up Node.js

If you’ve never used node, this is a good first step as it verifies you have the correct libraries for running the web application.

  • From the terminal, go to the web directory of the project and run npm install, after node_modules are installed, run node app. The movies website will be started at http://localhost:5000
  • Install Node.js either via homebrew using brew install node or directly from http://nodejs.org/
  • Navigate to the api and web folders and install dependencies running npm install in each.
  • Navigate to the web folder and run node app.js
  • Take a look at http://localhost:5000/
  • If you see some awesome movies there, success! :D

Setting up Neo4j

Installation

So Node.js is set up and you can see the boilerplate Movies application running on http://localhost:5000/, great. Now we want to set up an instance of Neo4j locally so we can look at and modify the data.

  • Download Neo4j here
  • Extract Neo4j to a convenient location and rename the folder to something less cumbersome, like ‘Neo4j’, if you want
  • Navigate to the extracted folder and run ./bin/neo4j start
  • If all goes well, you should see the Neo4j web application running at http://localhost:7474/

Adding the Movie data

Right now your Neo4j Database does not contain the Movie data. Let’s fix that.

  • Navigate to your Neo4j directory
  • If you have Neo4j running, stop it with ./bin/neo4j stop in the Neo4j directory
  • If you want to make sure you killed it good, check by running launchctl list | grep neo and launchctl remove any processes that might be listed
  • If you ls data, you’ll see a file called graph.db.
  • Delete the existing graph.db.
  • Grab the zipped movies graph database file from the databases folder in the web app
  • Unzip it into the data folder
  • Run Neo4j! You should be able to see some nodes at http://localhost:7474/

Setting up Swagger

You can see the demonstration web app is GETing information about movies and people from http://movieapi-neo4j.herokuapp.com. However, we want to be able to run the web application locally or from another server.

Learn more about Swagger.

Putting it all together

First, let's make a change to our local database so we know which database we're looking at.

Run the following query:

MATCH (n:Movie) WHERE n.`title` = 'The Matrix' SET n.rated = 'awesome' RETURN n

Swagger

Open to the api/neo4j/config.js file. You’ll see:

nconf.defaults({
    'neo4j': 'remote',
    'neo4j-local': 'http://localhost:7474',
    'neo4j-remote': 'http://default-environment-txj2pq5mwx.elasticbeanstalk.com/',

...

Replace the above with:

nconf.defaults({
    'neo4j': 'local',
    'neo4j-local': 'http://localhost:7474',
    'neo4j-remote': 'http://default-environment-txj2pq5mwx.elasticbeanstalk.com/',

...

From your parent directory, run node api/app.js to get Swagger started.

Head on over to http://localhost:3000/docs/, GET The Matrix you can do a search by title, for instance, and verify that this movie is now rated awesome.

The Frontend

Make sure whaveter database you're pointing at (whether a local one on port 7474 or a remote database) are running, and you've started your Swagger API with node api/app.js.

Again run node web/app.js in the neo4j-movies-template directory, and .\bin\neo4j start from your Neo4j directory, if it isn’t already running.

Verify that The Matrix is indeed rated awesome, and have fun.

neo4j-movies-template's People

Contributors

whatsocks avatar kbastani avatar chrisportela avatar jexp avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.