From bc06defa7cea987a0359f5cde5cb0f486101978d Mon Sep 17 00:00:00 2001 From: Brendan McDevitt Date: Tue, 5 Apr 2022 22:22:23 -0500 Subject: [PATCH] added controller and view for github_poc --- app/controllers/github_pocs_controller.rb | 16 ++++++++++++++++ app/views/github_pocs/index.html.erb | 1 + app/views/github_pocs/show.html.erb | 2 ++ config/routes.rb | 4 ++++ 4 files changed, 23 insertions(+) create mode 100644 app/controllers/github_pocs_controller.rb create mode 100644 app/views/github_pocs/index.html.erb create mode 100644 app/views/github_pocs/show.html.erb diff --git a/app/controllers/github_pocs_controller.rb b/app/controllers/github_pocs_controller.rb new file mode 100644 index 0000000..79861ca --- /dev/null +++ b/app/controllers/github_pocs_controller.rb @@ -0,0 +1,16 @@ +class GithubPocsController < ApplicationController + def index + @pocs = GithubPoc.all + end + + def show + @poc = GithubPoc.find_by(:id => params[:id]) + render json: @poc.to_json + end + + def show_for_cve + @poc = GithubPoc.where(:cve_id => params[:cve_id]) + render json: @poc.to_json + end + +end diff --git a/app/views/github_pocs/index.html.erb b/app/views/github_pocs/index.html.erb new file mode 100644 index 0000000..864544d --- /dev/null +++ b/app/views/github_pocs/index.html.erb @@ -0,0 +1 @@ +

GithubPocs#index

diff --git a/app/views/github_pocs/show.html.erb b/app/views/github_pocs/show.html.erb new file mode 100644 index 0000000..740ff12 --- /dev/null +++ b/app/views/github_pocs/show.html.erb @@ -0,0 +1,2 @@ +

@poc

+ diff --git a/config/routes.rb b/config/routes.rb index 4abadb2..cd68446 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,4 +6,8 @@ Rails.application.routes.draw do get "/cpes", to: "cpes#index" get "/cpes/:id", to: "cpes#show" + + get "/github_pocs", to: "github_pocs#index" + get "/github_pocs/:id", to: "github_pocs#show" + get "/github_pocs/cve/:cve_id", to: "github_pocs#show_for_cve" end