forked from SergeyBurtsev/trix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
36 lines (28 loc) · 780 Bytes
/
config.ru
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
require 'bundler/setup'
require 'rack/rewrite'
require 'pathname'
require 'json'
require 'blade'
root = Pathname.new(File.dirname(__FILE__))
require root.join('lib/trix/environment')
environment = Trix::Environment.new(root)
environment.paths = %w( assets polyfills src )
require root.join('lib/trix/attachment_server')
Trix::AttachmentServer.root = root.join('tmp/attachments')
use Blade::RackAdapter, mount: '/test'
map '/' do
run environment.sprockets_environment
use Rack::Rewrite do
rewrite '/', '/demo.html'
end
end
map '/attachments' do
run Trix::AttachmentServer
end
map '/submit' do
run -> (env) do
request = Rack::Request.new(env)
response = JSON.dump(request.params)
[200, {'Content-Type' => 'application/json'}, [response]]
end
end