graph.rb 558 B

12345678910111213141516171819202122
  1. # frozen_string_literal: true
  2. lib_dir = File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'lib')
  3. $LOAD_PATH.unshift(lib_dir) unless
  4. $LOAD_PATH.include?(lib_dir) || $LOAD_PATH.include?(lib_dir)
  5. require 'json'
  6. require 'neoinfra'
  7. require 'sinatra'
  8. require 'sinatra/base'
  9. require 'sinatra/contrib'
  10. # Handle loading data into the graph db
  11. class Graph < Sinatra::Base
  12. register Sinatra::RespondWith
  13. set :views, File.join(File.dirname(__FILE__), '..', '/views')
  14. get '/vpcs' do
  15. g = NeoInfra::Graph.new
  16. g.graph_vpcs.to_json
  17. end
  18. end