问题描述:

I config DATABASE_URL in my dashboard.

When I do in my prompt heroku config

I get:

[email protected]:~/Escritorio/mis_proyectos/quiz$ heroku config

=== quiz-miguel2015 Config Vars

DATABASE_URL: postgres://fudidvccwppmri:[email protected]om:5432/d4fh6o7fu6cv5q

HEROKU_POSTGRESQL_GOLD_URL: postgres://fudidvccwppmri:[email protected]om:5432/d4fh6o7fu6cv5q

NODE_ENV: production

but I get this fail:

undefined

/home/miguel/Escritorio/mis_proyectos/quiz/models/models.js:5

var url = process.env.DATABASE_URL.match(/(.*)\:\/\/(.*?)\:(.*)@(.*)\:(.*)\/(.

^

TypeError: Cannot call method 'match' of undefined

at Object.<anonymous>

My file where I get the fail models.js

var path = require('path');

// Postgres DATABASE_URL = postgres://user:[email protected]:port/database

// SQLite DATABASE_URL = sqlite://:@:/

console.dir(process.env.DATABASE_URL);

var url = process.env.DATABASE_URL.match(/(.*)\:\/\/(.*?)\:(.*)@(.*)\:(.*)\/(.*)/);

I have created my file .env with the following values in the root :

DATABASE_URL=sqlite://:@:/

DATABASE_STORAGE=quiz.sqlite

Here I get the complete log:

TypeError: Cannot call method 'match' of undefined

at Object.<anonymous> (/home/miguel/Escritorio/mis_proyectos/quiz/models/models.js:5:36)

at Module._compile (module.js:456:26)

at Object.Module._extensions..js (module.js:474:10)

at Module.load (module.js:356:32)

at Function.Module._load (module.js:312:12)

at Module.require (module.js:364:17)

at require (module.js:380:17)

at Object.<anonymous> (/home/miguel/Escritorio/mis_proyectos/quiz/controllers/quiz_controller.js:2:14)

at Module._compile (module.js:456:26)

at Object.Module._extensions..js (module.js:474:10)

at Module.load (module.js:356:32)

the code is in => https://github.com/Mangulomx/Quiz

相关阅读:
Top