chore: Extract knex model integration to separate file
This commit is contained in:
@@ -6,15 +6,12 @@ import corsOptions from './config/cors-options';
|
|||||||
import graphQLInstance from './helpers/graphql-instance';
|
import graphQLInstance from './helpers/graphql-instance';
|
||||||
import logger from './helpers/logger';
|
import logger from './helpers/logger';
|
||||||
import morgan from './helpers/morgan';
|
import morgan from './helpers/morgan';
|
||||||
import errorHandler from './helpers/error-handler'
|
import errorHandler from './helpers/error-handler';
|
||||||
import { Model } from 'objection';
|
import './config/database';
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = appConfig.port;
|
const port = appConfig.port;
|
||||||
|
|
||||||
import knex from './config/database';
|
|
||||||
Model.knex(knex)
|
|
||||||
|
|
||||||
app.use(morgan);
|
app.use(morgan);
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
import { Model } from 'objection';
|
||||||
import knexInstance from 'knex';
|
import knexInstance from 'knex';
|
||||||
import knexConfig from '../../knexfile';
|
import knexConfig from '../../knexfile';
|
||||||
|
|
||||||
const knex = knexInstance(knexConfig)
|
const knex = knexInstance(knexConfig)
|
||||||
|
Model.knex(knex)
|
||||||
export default knex;
|
|
||||||
|
Reference in New Issue
Block a user