This is a boilerplate app for quora-clone. It will be used to build quora-clone and help you learn web server fundamentals such as HTTP(GET/POST), RESTful Routes, Cookies and the MVC Framework.
The directory structure emulates Rails MVC Framework using Sinatra.
quora-boilerplate
├─ config/
│ ├── database.rb <-- config for connecting to postgresql
│ └── init.rb <-- app config file
├─ controllers/ <-- folder for controllers
├─ db/
│ └── migrate/ <-- folder for AR migrations
├─ helpers/ <-- folder for helpers
├─ models/ <-- folder for AR models
├─ public/ <-- folder for public assets (CSS, JS, images)
│ ├── css
│ └── js
├─ views/
│ └── application.erb <-- main template
├─ Rakefile <-- contains rake tasks to run CLI/server commands
├─ README.md
├─ app.rb <-- initial controller
└─ Gemfile <-- to include Ruby gems
- Run
bundle install
to install all gem dependencies - Start the server by running
ruby app.rb
Note: Everytime you change a file, you will need to restart the server.
- Open
Gemfile
and uncomment
group :development
gem "shotgun"
end
- Remove
set :run, true
inapp.rb
- Run
bundle install
- Run server with
shotgun app.rb
orbundle exec shotgun app.rb