Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add optional REPL (start with 'node server.js repl')

  • Loading branch information...
commit d854000b5f556319accdc59b83e10e6607bf511c 1 parent 1f4e67b
Sebastian Kippe authored
Showing with 17 additions and 4 deletions.
  1. +2 −2 package.json
  2. +15 −2 server.js
4 package.json
View
@@ -1,7 +1,7 @@
{
"name": "express-storage",
"description": "Light-weight remoteStorage provider",
- "version": "0.1.0-9",
+ "version": "0.1.0-12",
"homepage": "https://github.com/5apps/express-storage",
"author": {
"name": "Michiel de Jong, Sebastian Kippe, Garret Alfert",
@@ -39,4 +39,4 @@
"start": "server.js"
},
"subdomain": "express-storage"
-}
+}
17 server.js
View
@@ -77,6 +77,11 @@ app.post(/^\/_oauth\/(?:(.+))/, function(req, res){
});
});
+app.get("/create_test_user", function(req, res){
+ storage.addUser('jimmy@'+config.host, '12345678', function(){});
+ res.send("User created");
+});
+
app.options('*', function(req, res){
res.header('Access-Control-Allow-Origin', req.headers.origin);
res.header('Access-Control-Allow-Methods', 'GET, PUT, DELETE');
@@ -130,7 +135,15 @@ app.all('/:user/:category/:key', function(req, res){
if (!module.parent) {
app.listen(config.port);
console.log("Express server listening on port %d", config.port);
- console.log(util.inspect(config));
+ // console.log("Config:");
+ // console.log(util.inspect(config));
+}
- storage.addUser('jimmy@'+config.host, '12345678', function(){});
+// REPL
+if (process.argv[2] == "repl") {
+ var repl = require("repl");
+ var context = repl.start("$ ").context;
+ context.util = require('util');
+ context.config = require('./config.js').config;
+ context.storage = require('./lib/express-storage.js').storage;
}
Please sign in to comment.
Something went wrong with that request. Please try again.