1
0
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:
sveisvei 2016-11-13 21:07:14 +01:00 committed by Ivar Conradi Østhus
parent 95b5475991
commit 1dab39f0f9
10 changed files with 21 additions and 17 deletions

View File

@ -5,7 +5,7 @@ process.env.NODE_ENV = 'production';
const { publicFolder } = require('unleash-frontend'); const { publicFolder } = require('unleash-frontend');
const program = require('commander'); const program = require('commander');
const unleash = require('../server-impl.js'); const unleash = require('../lib/server-impl.js');
program program
.option('-p, --port <port>', 'The port you want to start unleash on') .option('-p, --port <port>', 'The port you want to start unleash on')
@ -15,7 +15,7 @@ program
unleash.start({ unleash.start({
databaseUri: program.databaseUri || process.env.DATABASE_URL, databaseUri: program.databaseUri || process.env.DATABASE_URL,
port: program.port || process.env.PORT || 4242, port: program.port || process.env.PORT || 4242,
publicFolder publicFolder,
}).then(conf => { }).then(conf => {
console.log(`Unleash started on port:${conf.app.get('port')}`); console.log(`Unleash started on port:${conf.app.get('port')}`);
}); });

View File

@ -6,8 +6,8 @@ const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');
const validator = require('express-validator'); const validator = require('express-validator');
const log4js = require('log4js'); const log4js = require('log4js');
const logger = require('./lib/logger'); const logger = require('./logger');
const routes = require('./lib/routes'); const routes = require('./routes');
const path = require('path'); const path = require('path');
const errorHandler = require('errorhandler'); const errorHandler = require('errorhandler');

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
const logger = require('./lib/logger'); const logger = require('./logger');
const migrator = require('./migrator'); const migrator = require('../migrator');
const { createStores } = require('./lib/db'); const { createStores } = require('./db');
const getApp = require('./app'); const getApp = require('./lib/app');
const DEFAULT_OPTIONS = { const DEFAULT_OPTIONS = {
databaseUri: process.env.DATABASE_URL || 'postgres://unleash_user:passord@localhost:5432/unleash', databaseUri: process.env.DATABASE_URL || 'postgres://unleash_user:passord@localhost:5432/unleash',

View File

@ -33,8 +33,8 @@
"unleash": "./bin/unleash.js" "unleash": "./bin/unleash.js"
}, },
"scripts": { "scripts": {
"start": "node server-dev.js", "start": "node server.js",
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/ server-dev.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": "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", "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", "db-migrate": "db-migrate up",

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
const unleash = require('./server-impl'); const unleash = require('./lib/server-impl');
const { publicFolder } = require('unleash-frontend'); const { publicFolder } = require('unleash-frontend');
unleash.start({ publicFolder }); unleash.start({ publicFolder });

View File

@ -6,7 +6,7 @@ const supertest = require('supertest');
const migrator = require('../../../migrator'); const migrator = require('../../../migrator');
const { createStores } = require('../../../lib/db'); const { createStores } = require('../../../lib/db');
const { createDb } = require('../../../lib/db/db-pool'); const { createDb } = require('../../../lib/db/db-pool');
const _app = require('../../../app'); const getApp = require('../../../lib/app');
require('db-migrate-shared').log.silence(true); require('db-migrate-shared').log.silence(true);
// because of migrator bug // because of migrator bug
@ -26,7 +26,7 @@ function createApp (databaseSchema = 'test') {
.then(() => { .then(() => {
db.destroy(); db.destroy();
const stores = createStores(options); const stores = createStores(options);
const app = _app({ stores }); const app = getApp({ stores });
return { return {
stores, stores,
request: supertest(app), request: supertest(app),

View File

@ -4,6 +4,7 @@ const test = require('ava');
const store = require('./fixtures/store'); const store = require('./fixtures/store');
const supertest = require('supertest'); const supertest = require('supertest');
const logger = require('../../../lib/logger'); const logger = require('../../../lib/logger');
const getApp = require('../../../lib/app');
test.beforeEach(() => { test.beforeEach(() => {
logger.setLevel('FATAL'); logger.setLevel('FATAL');
@ -12,7 +13,7 @@ test.beforeEach(() => {
function getSetup () { function getSetup () {
const base = `/random${Math.round(Math.random() * 1000)}`; const base = `/random${Math.round(Math.random() * 1000)}`;
const stores = store.createStores(); const stores = store.createStores();
const app = require('../../../app')({ const app = getApp({
baseUriPath: base, baseUriPath: base,
stores, stores,
}); });

View File

@ -4,6 +4,7 @@ const test = require('ava');
const store = require('./fixtures/store'); const store = require('./fixtures/store');
const supertest = require('supertest'); const supertest = require('supertest');
const logger = require('../../../lib/logger'); const logger = require('../../../lib/logger');
const getApp = require('../../../lib/app');
test.beforeEach(() => { test.beforeEach(() => {
logger.setLevel('FATAL'); logger.setLevel('FATAL');
@ -13,7 +14,7 @@ test.beforeEach(() => {
function getSetup () { function getSetup () {
const stores = store.createStores(); const stores = store.createStores();
const db = stores.db; const db = stores.db;
const app = require('../../../app')({ const app = getApp({
baseUriPath: '', baseUriPath: '',
stores, stores,
}); });

View File

@ -4,6 +4,7 @@ const test = require('ava');
const store = require('./fixtures/store'); const store = require('./fixtures/store');
const supertest = require('supertest'); const supertest = require('supertest');
const logger = require('../../../lib/logger'); const logger = require('../../../lib/logger');
const getApp = require('../../../lib/app');
test.beforeEach(() => { test.beforeEach(() => {
logger.setLevel('FATAL'); logger.setLevel('FATAL');
@ -11,7 +12,7 @@ test.beforeEach(() => {
function getSetup () { function getSetup () {
const stores = store.createStores(); const stores = store.createStores();
const app = require('../../../app')({ const app = getApp({
baseUriPath: '', baseUriPath: '',
stores, stores,
}); });

View File

@ -4,6 +4,7 @@ const test = require('ava');
const store = require('./fixtures/store'); const store = require('./fixtures/store');
const supertest = require('supertest'); const supertest = require('supertest');
const logger = require('../../../lib/logger'); const logger = require('../../../lib/logger');
const getApp = require('../../../lib/app');
test.beforeEach(() => { test.beforeEach(() => {
logger.setLevel('FATAL'); logger.setLevel('FATAL');
@ -11,7 +12,7 @@ test.beforeEach(() => {
test('should add version numbers for /stategies', t => { test('should add version numbers for /stategies', t => {
const stores = store.createStores(); const stores = store.createStores();
const app = require('../../../app')({ const app = getApp({
baseUriPath: '', baseUriPath: '',
stores, stores,
}); });