mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
move app and server-impl into lib folder
This commit is contained in:
parent
95b5475991
commit
1dab39f0f9
@ -5,7 +5,7 @@ process.env.NODE_ENV = 'production';
|
||||
|
||||
const { publicFolder } = require('unleash-frontend');
|
||||
const program = require('commander');
|
||||
const unleash = require('../server-impl.js');
|
||||
const unleash = require('../lib/server-impl.js');
|
||||
|
||||
program
|
||||
.option('-p, --port <port>', 'The port you want to start unleash on')
|
||||
@ -15,7 +15,7 @@ program
|
||||
unleash.start({
|
||||
databaseUri: program.databaseUri || process.env.DATABASE_URL,
|
||||
port: program.port || process.env.PORT || 4242,
|
||||
publicFolder
|
||||
publicFolder,
|
||||
}).then(conf => {
|
||||
console.log(`Unleash started on port:${conf.app.get('port')}`);
|
||||
});
|
||||
|
@ -6,8 +6,8 @@ const bodyParser = require('body-parser');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const validator = require('express-validator');
|
||||
const log4js = require('log4js');
|
||||
const logger = require('./lib/logger');
|
||||
const routes = require('./lib/routes');
|
||||
const logger = require('./logger');
|
||||
const routes = require('./routes');
|
||||
const path = require('path');
|
||||
const errorHandler = require('errorhandler');
|
||||
|
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const logger = require('./lib/logger');
|
||||
const migrator = require('./migrator');
|
||||
const { createStores } = require('./lib/db');
|
||||
const getApp = require('./app');
|
||||
const logger = require('./logger');
|
||||
const migrator = require('../migrator');
|
||||
const { createStores } = require('./db');
|
||||
const getApp = require('./lib/app');
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
databaseUri: process.env.DATABASE_URL || 'postgres://unleash_user:passord@localhost:5432/unleash',
|
@ -33,8 +33,8 @@
|
||||
"unleash": "./bin/unleash.js"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node server-dev.js",
|
||||
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/ server-dev.js",
|
||||
"start": "node server.js",
|
||||
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/ server.js",
|
||||
"start:dev:pg": "pg_virtualenv npm run start:dev:pg-chain",
|
||||
"start:dev:pg-chain": "export DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; db-migrate up && npm run start:dev",
|
||||
"db-migrate": "db-migrate up",
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const unleash = require('./server-impl');
|
||||
const unleash = require('./lib/server-impl');
|
||||
const { publicFolder } = require('unleash-frontend');
|
||||
|
||||
unleash.start({ publicFolder });
|
@ -6,7 +6,7 @@ const supertest = require('supertest');
|
||||
const migrator = require('../../../migrator');
|
||||
const { createStores } = require('../../../lib/db');
|
||||
const { createDb } = require('../../../lib/db/db-pool');
|
||||
const _app = require('../../../app');
|
||||
const getApp = require('../../../lib/app');
|
||||
require('db-migrate-shared').log.silence(true);
|
||||
|
||||
// because of migrator bug
|
||||
@ -26,7 +26,7 @@ function createApp (databaseSchema = 'test') {
|
||||
.then(() => {
|
||||
db.destroy();
|
||||
const stores = createStores(options);
|
||||
const app = _app({ stores });
|
||||
const app = getApp({ stores });
|
||||
return {
|
||||
stores,
|
||||
request: supertest(app),
|
||||
|
@ -4,6 +4,7 @@ const test = require('ava');
|
||||
const store = require('./fixtures/store');
|
||||
const supertest = require('supertest');
|
||||
const logger = require('../../../lib/logger');
|
||||
const getApp = require('../../../lib/app');
|
||||
|
||||
test.beforeEach(() => {
|
||||
logger.setLevel('FATAL');
|
||||
@ -12,7 +13,7 @@ test.beforeEach(() => {
|
||||
function getSetup () {
|
||||
const base = `/random${Math.round(Math.random() * 1000)}`;
|
||||
const stores = store.createStores();
|
||||
const app = require('../../../app')({
|
||||
const app = getApp({
|
||||
baseUriPath: base,
|
||||
stores,
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ const test = require('ava');
|
||||
const store = require('./fixtures/store');
|
||||
const supertest = require('supertest');
|
||||
const logger = require('../../../lib/logger');
|
||||
const getApp = require('../../../lib/app');
|
||||
|
||||
test.beforeEach(() => {
|
||||
logger.setLevel('FATAL');
|
||||
@ -13,7 +14,7 @@ test.beforeEach(() => {
|
||||
function getSetup () {
|
||||
const stores = store.createStores();
|
||||
const db = stores.db;
|
||||
const app = require('../../../app')({
|
||||
const app = getApp({
|
||||
baseUriPath: '',
|
||||
stores,
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ const test = require('ava');
|
||||
const store = require('./fixtures/store');
|
||||
const supertest = require('supertest');
|
||||
const logger = require('../../../lib/logger');
|
||||
const getApp = require('../../../lib/app');
|
||||
|
||||
test.beforeEach(() => {
|
||||
logger.setLevel('FATAL');
|
||||
@ -11,7 +12,7 @@ test.beforeEach(() => {
|
||||
|
||||
function getSetup () {
|
||||
const stores = store.createStores();
|
||||
const app = require('../../../app')({
|
||||
const app = getApp({
|
||||
baseUriPath: '',
|
||||
stores,
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ const test = require('ava');
|
||||
const store = require('./fixtures/store');
|
||||
const supertest = require('supertest');
|
||||
const logger = require('../../../lib/logger');
|
||||
const getApp = require('../../../lib/app');
|
||||
|
||||
test.beforeEach(() => {
|
||||
logger.setLevel('FATAL');
|
||||
@ -11,7 +12,7 @@ test.beforeEach(() => {
|
||||
|
||||
test('should add version numbers for /stategies', t => {
|
||||
const stores = store.createStores();
|
||||
const app = require('../../../app')({
|
||||
const app = getApp({
|
||||
baseUriPath: '',
|
||||
stores,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user