forked from moskvinaanna/notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
38 lines (34 loc) · 944 Bytes
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true
require 'roda'
require 'sequel'
require 'sqlite3'
require_relative 'helpers/contract_helper'
require_relative 'helpers/successfull_result'
require_relative 'lib/notes_contract'
require_relative 'lib/edit_contract'
require_relative 'lib/date_contract'
require_relative 'lib/invitations_contract'
# app class
class App < Roda
plugin :render
plugin :public
plugin :hash_routes
plugin :view_options
DB = Sequel.connect("sqlite:///#{File.expand_path('./db/notes.db', __dir__)}")
require_relative 'models/note'
require_relative 'models/status'
include ContractHelper
opts[:notes] = Note
opts[:statuses] = Status
require_relative 'routes/home_page_route'
require_relative 'routes/notes_route'
require_relative 'routes/closest_dates_route'
require_relative 'routes/invites_route'
route do |r|
r.public
r.hash_branches
r.root do
r.redirect '/home_page'
end
end
end