Skip to content

Commit b32ff7c

Browse files
committed
Some documentation tweaks
1 parent c2f0ca7 commit b32ff7c

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

README.md

+20-23
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A Ruby server for the [tus resumable upload protocol]. It implements the core
1313

1414
```rb
1515
# Gemfile
16-
gem "tus-server", "~> 2.0"
16+
gem "tus-server", "~> 2.3"
1717
```
1818

1919
## Usage
@@ -28,44 +28,41 @@ Rails.application.routes.draw do
2828
end
2929
```
3030

31-
Otherwise you can run it in `config.ru`:
32-
33-
```rb
34-
# config.ru (Rack)
35-
require "tus/server"
36-
37-
map "/files" do
38-
run Tus::Server
39-
end
40-
```
41-
4231
Now you can tell your tus client library (e.g. [tus-js-client]) to use this
4332
endpoint:
4433

4534
```js
4635
// using tus-js-client
4736
new tus.Upload(file, {
48-
endpoint: "/files",
49-
chunkSize: 5*1024*1024, // required unless using Falcon
37+
endpoint: '/files',
38+
chunkSize: 5*1024*1024, // chunking is required unless you're using Falcon
5039
// ...
5140
})
41+
42+
// OR
43+
44+
// using Uppy
45+
uppy.use(Uppy.Tus, {
46+
endpoint: '/files',
47+
chunkSize: 5*1024*1024, // chunking is required unless you're using Falcon
48+
})
5249
```
5350

5451
By default uploaded files will be stored in the `data/` directory. After the
5552
upload is complete, you'll probably want to attach the uploaded file to a
56-
database record. [Shrine] is currently the only file attachment library that
57-
provides an integration with tus-ruby-server, see [this walkthrough][shrine
58-
resumable walkthrough] that adds resumable uploads from scratch, and for a
59-
complete example you can check out the [demo app][shrine-tus-demo].
53+
database record. [Shrine] is a file attachment library that provides
54+
integration with tus-ruby-server, see [this walkthrough][shrine resumable
55+
walkthrough] that adds resumable uploads from scratch, and for a complete
56+
example you can check out the [demo app][shrine-tus-demo].
6057

6158
### Streaming web server
6259

6360
Running the tus server alongside your main app using popular web servers like
64-
Puma or Unicorn is probably fine for most cases, however, it does come with a
65-
few gotchas. First, since these web servers don't accept partial requests
66-
(request where the request body hasn't been fully received), the tus client
67-
must be configured to split the upload into multiple requests. Second, since
68-
web workers are tied for the duration of the request, serving uploaded files
61+
Puma or Unicorn is probably fine for most cases, but it does come with a few
62+
gotchas. First, since these web servers don't accept partial requests (request
63+
where the request body hasn't been fully received), the tus client must be
64+
configured to split the upload into multiple requests. Second, since web
65+
workers are tied for the duration of the request, serving uploaded files
6966
through the tus server app could significantly impact request throughput; this
7067
can be avoided by having your frontend server (Nginx) serve the files if using
7168
`Filesystem` storage, or if you're using a cloud service like S3 having

0 commit comments

Comments
 (0)