0

I am trying to run cubeJs-backend application using express. I have added code changes like below. I have created cube.js file with the below code

const express = require('express');
const path = require('path');

const expressApp = express();

const options = {
basePath: 'cube'
  }
  require('dotenv').config();
const core = CubejsServerCore.create(options);
core.initApp(expressApp);

I have used .env file for the environment variables. When I run the application using node cube.js the application got started and also connecting to the data base. But, when I try to load in the browser using http://localhost:4000 it is not loading.

Here is my .env values:

CUBEJS_DB_HOST=localhost
CUBEJS_DB_PORT=5438
CUBEJS_DB_NAME=test
CUBEJS_DB_USER=postgres
CUBEJS_DB_PASS=test
CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE=postgres
CUBEJS_API_SECRET=b6e176d3942fd2811bacfd2b5e5dd00b47aae3f07d92000961f17c60f4d9a30eca5bfde0e1f2d460d9e358a0a6be7b3fa6812f245713915a1effea402a716c13
CUBEJS_EXTERNAL_DEFAULT=true
CUBEJS_SCHEDULED_REFRESH_DEFAULT=true
CUBEJS_WEB_SOCKETS=true
Rewa
  • 1
  • 2

1 Answers1

0

Embedding Cube.js within Express (any other framework / in application) is deprecated.

I suggest you run Cube.js with Docker, as it’s a better solution than embedding it into an Express app.

This link might be helpful as well: https://cube.dev/blog/cubejs-loves-docker