sinatraで作ったアプリがjsのファイルを読み込んでくれません
下記がアプリケーションのディレクトリ構成とそのプログラムの概要です
root
-Gemfile
-Gemfile.lock
-main.rb
-public
-sample.js
-views
-index.haml
ruby
1#main.rb 2require 'sinatra' 3require 'haml' 4 5get '/' do 6 haml :index 7end
javascript
1//sample.js 2console.log(1)
haml
1%html 2 %head 3 %title sample 4 %body 5 %script{:src => "public/sample.js"}
Chromeのコンソールに出るエラー
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4567/public/sample.js
よろしくお願いします
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/10/25 14:38