Skip to content

Commit e045e6f

Browse files
committed
Document how to deploy the server as middleware
See #16
1 parent fa01907 commit e045e6f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Not published yet, [coming soon](https://github.com/tus/tus-node-server/mileston
3434

3535
## Quick Start
3636

37-
#### Build a server
37+
#### Build a standalone server
3838
```javascript
3939
const tus = require('tus-node-server');
4040
@@ -50,6 +50,22 @@ server.listen({ host, port }, () => {
5050
});
5151
```
5252
53+
#### Alternatively, you could deploy tus-node-server as [Express Middleware](http://expressjs.com/en/guide/using-middleware.html)
54+
55+
```javascript
56+
const tus = require('tus-node-server');
57+
const server = new tus.Server();
58+
server.datastore = new tus.FileStore({
59+
path: '/files'
60+
});
61+
62+
var app = express();
63+
app.all('/files/*', function(req, res) {
64+
server.handle(req, res);
65+
});
66+
app.listen(port, host);
67+
```
68+
5369
#### Run the server
5470
```bash
5571
$ node server.js

0 commit comments

Comments
 (0)