Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added requirejs example

  • Loading branch information...
commit ca44f83fab0cfd14c764188ae300b32d55c5ba0f 1 parent 35591f1
siedrix authored
View
3  .gitignore
@@ -12,3 +12,6 @@ logs
results
npm-debug.log
+
+.DS_Store
+*/node_modules
View
12 requirejs/example.js
@@ -0,0 +1,12 @@
+var requirejs = require('requirejs');
+
+requirejs.config({
+ baseUrl: 'modules',
+ nodeRequire: require
+});
+
+requirejs(['server'], function(server){
+ server.listen(3000);
+
+ console.log('server running at http://localhost:3000');
+});
View
7 requirejs/modules/models.js
@@ -0,0 +1,7 @@
+define(['resourceful'], function (resourceful) {
+ resourceful.use('couchdb', {
+ database : 'test'
+ });
+
+ return resourceful;
+});
View
11 requirejs/modules/server.js
@@ -0,0 +1,11 @@
+define(['express','user'], function (express, User) {
+ var server = express();
+
+ server.get('/', function (req,res) {
+ User.all(function(err, docs){
+ res.send(err || docs);
+ });
+ });
+
+ return server;
+});
View
9 requirejs/modules/user.js
@@ -0,0 +1,9 @@
+define(['models'], function(models){
+ var User = models.define('user', function () {
+ //Properties
+ this.string('username');
+ this.object('password');
+ });
+
+ return User;
+});
View
9 requirejs/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "requirejs-example",
+ "version": "0.0.1",
+ "dependencies": {
+ "requirejs" : "2.1.1",
+ "resourceful" : "0.3.3",
+ "express" : "3.0.3"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.