Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should I be able to 'require' in the repl? #1

Open
jimthedev opened this issue Sep 11, 2015 · 4 comments
Open

Should I be able to 'require' in the repl? #1

jimthedev opened this issue Sep 11, 2015 · 4 comments

Comments

@jimthedev
Copy link

Just wondering if the intended functionality is for me to be able to use require('path') or the like inside the repl?

Currently I get Error: require is not defined

@dthree
Copy link
Contributor

dthree commented Sep 11, 2015

Really? It should definitely handle it. Can you show me exactly what you did?

@jimthedev
Copy link
Author

Sure.

Here is my setup:


// Express
var express = require('express');
var history = require('connect-history-api-fallback');
var morgan  = require('morgan');
var bodyParser = require('body-parser');

// Express App
var app = express();

// Env
var PORT     = process.env.PORT || 3000;
var NODE_ENV = process.env.NODE_ENV || 'development';

app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

// Angular Http content type for POST etc defaults to text/plain at
app.use(bodyParser.text(), function ngHttpFix(req, res, next) {
  try {
    req.body = JSON.parse(req.body);
    next();
  } catch(e) {
    next();
  }
});

// Your middleware
app.use(history());
app.use(express.static('src/public'));

var api = require('./todo_api')();
app.use('/api', api);

  // Vantage Repl
var vantage = require('vantage');

var vantageServer = vantage()
 .delimiter('svr:5000~$')
 .listen(app, 5000)
 .show();

I am on node 0.12.0 and OSX.

@dthree
Copy link
Contributor

dthree commented Sep 12, 2015

Thanks. Checking it out.

@jesusprubio
Copy link

Hi, same problem here. As a temporal (dirty) workaround I'm using this:
global.require = require;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants