A literary workshop app based on node.js
See below for installation instructions.
############################## I M P O R T A N T VERSION INFO ############################## This is the initial version, Tag: v0.4.9 of the master branch, so tagged because it was written before node.js version 0.5.x . If you run this version of lit on a system running node later than 0.4.x, then you will get the following error:
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
This will happen because not only is the system running a newer version of node, but all the dependency modules have early installed versions.
To run this version, then, it is important to use a node.js binary manager like https://github.com/visionmedia/n
To install version 0.4.9 of Node.js and to make it the current version on your system if it is already installed:
n 0.4.9
Then you can do
node app
in the usual way.
For now this is a pedagogical effort aimed at acquiring solvency for using a node.js, express.js and couchdb stack.
When it is completed, there will be an active demo site using it. I actually would like to write a flash fiction piece every day using this.
All code and docs, all process for the project, are right here on github; go to Wiki for User Stories and [Architectural Document]((https://github.com/victorkane/lit/wiki/Architecture-document), see Issue Tracking for project overview and User Manual (when ready).
Following User story has now been implemented by persisting texts by author in Couchdb on the basis of the clean Text prototype originally implemented as a fake data store (based on Express blog example post model):
Wiki view: As a writer I can work on my texts
Implementation issue view: As a writer I can work on my texts
We may now want to refactor the User model along the same lines
Main next step: to go back and finish #6 with full navigation as per Getting started.
User profile has already been persisted in CouchDB:
Wiki view: As a writer I can register as a user and work on my account and profile
Implementation issue view: As a writer I can register as a user and work on my account and profile
- Install node.js, express.js, couchdb and npm on your system. See Setting up Cloud App Server with CouchDB, Node.js and Express on Ubuntu 10.04 LTS Part I for detailed instructions, or seek out simple one click installs from homebrew (Mac), apt-get, couchbase and other sources.
- Clone this project:
$ git clone [email protected]:victorkane/lit.git
- cd into the lit project directory
- Install all dependencies via npm:
npm install
- You should see something like the following:
$ npm install
[email protected] ./node_modules/express-messages
[email protected] ./node_modules/jade
[email protected] ./node_modules/express/node_modules/mime
[email protected] ./node_modules/express/node_modules/qs
[email protected] ./node_modules/express/node_modules/connect
[email protected] ./node_modules/express
[email protected] ./node_modules/cradle/node_modules/vargs
[email protected] ./node_modules/cradle/node_modules/vows/node_modules/eyes
[email protected] ./node_modules/cradle/node_modules/vows
[email protected] ./node_modules/cradle
- Prepare CouchDB databases (see also ./couchdb/install.txt
- cd couchdb
- Execute the following four commands, which will create two databases and install a default design document for each that the application expects to find (as an alternative, of course the two databases can be created and the design documents created via the regular CouchDB administration interface).
- Create the
lit_users
database$ curl -X PUT http://localhost:5984/lit_users
- Create the
lit_texts
database$ curl -X PUT http://localhost:5984/lit_texts
- Create the default design document for
lit_users
(file./couchdb/lit_users.design
)$ curl -X PUT http://localhost:5984/lit_users/_design/default -d @lit_users.design
- Create the default design document for
lit_texts
(file./couchdb/lit_texts.design
)$ curl -X PUT http://localhost:5984/lit_texts/_design/default -d @lit_texts.design
- Create the
Sample run in ./couchdb/install.txt:
$ curl -X PUT http://localhost:5984/lit_users
{"ok":true}
$ curl -X PUT http://localhost:5984/lit_texts
{"ok":true}
$ curl -X PUT http://localhost:5984/lit_users/_design/default -d @lit_users.design
{"ok":true,"id":"_design/default","rev":"1-d22ea3c0e94f928461b66228b2aea78b"}
$ curl -X PUT http://localhost:5984/lit_texts/_design/default -d @lit_texts.design
{"ok":true,"id":"_design/default","rev":"1-2d943dded0d253c862d23b366f7ea037"}
$
- Execute app from the project root
node app.js
- Point your browser at
http://localhost:3000/
- Click on
Register
to register a user, then login and create some texts and check out the code!