Skip to content

Commit

Permalink
setup database
Browse files Browse the repository at this point in the history
  • Loading branch information
joesantosgarcia committed May 10, 2017
1 parent d02bacb commit cb347a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/config/database.cr
@@ -1,4 +1,4 @@
require "mysql"

MYSQL = DB.open("mysql://root:root@127.0.0.1:3306/movies")
at_exit { MYSQL.close }
# MYSQL = DB.open("mysql://root:root@127.0.0.1:3306/movies")
# at_exit { MYSQL.close }
20 changes: 0 additions & 20 deletions src/routes/web.cr
Expand Up @@ -2,23 +2,3 @@
get "/" do
render "src/views/pages/homepage.ecr", "src/views/layouts/main.ecr"
end

get "/protect" do |env|
env.response.status_code = 403
end

get "/movies" do
MYSQL.exec "
CREATE TABLE IF NOT EXISTS movies
(
id int not null auto_increment,
title varchar(30),
year int,
description LONGTEXT,
primary key (id)
)"

MYSQL.exec "
INSERT INTO movies (title, year, description)
VALUES ('Star Trek', '1996', 'A SHITTY MOVIE');"
end

0 comments on commit cb347a8

Please sign in to comment.