Skip to content

Commit

Permalink
Update docs and examples for using pure express without connect
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbrowne committed Oct 18, 2024
1 parent db92775 commit d0be41c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ There are two ways to run a sharejs server:
1. Embedded in a node.js server app:

```javascript
var connect = require('connect'),
var express = require('express'),
logger = require('morgan'),
sharejs = require('share').server;

var app = connect(
connect.logger(),
connect.static(__dirname + '/my_html_files')
);
var app = express();
app.use(logger('dev'));
app.use(express.static(__dirname + '/my_html_files'));

var options = {db: {type: 'none'}}; // See docs for options. {type: 'pg'} to enable persistance.

// Attach the sharejs REST and Socket.io interfaces to the server
// Attach the sharejs interfaces to the server
server = sharejs.attach(app, options);

server.listen(9000);
console.log('Server running at http://127.0.0.1:9000/');
```
The above script will start up a ShareJS server on port 9000 which hosts static content from the `my_html_files` directory. See [bin/exampleserver](https://github.com/josephg/ShareJS/blob/master/bin/exampleserver) for a more complex configuration example.

> See the [Connect](http://senchalabs.github.com/connect/) or [Express](http://expressjs.com/) documentation for more complex routing.
> See the [Express](http://expressjs.com/) documentation for more complex routing.

2. From the command line:

Expand Down
8 changes: 4 additions & 4 deletions src/server/db/pg.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#
# Example usage:
#
# var connect = require('connect');
# var express = require('express');
# var share = require('share').server;
#
# var server = connect(connect.logger());
# var app = express();
#
# var options = {
# db: {
Expand All @@ -18,8 +18,8 @@
# }
# };
#
# share.attach(server, options);
# server.listen(9000);
# app.set('port', 9000);
# share.attach(app, options);
#
# You can run bin/setup_pg to create the SQL tables initially.

Expand Down

0 comments on commit d0be41c

Please sign in to comment.