mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-21 16:52:03 -07:00
Change config/config.js to a default config/index.js
This commit is contained in:
+4
-5
@@ -5,10 +5,9 @@ import logger from 'koa-logger'
|
||||
import mongoose from 'mongoose'
|
||||
import session from 'koa-generic-session'
|
||||
import passport from 'koa-passport'
|
||||
import serve from 'koa-static'
|
||||
|
||||
import config from './config'
|
||||
import { errorMiddleware } from '../src/middleware'
|
||||
import config from '../config'
|
||||
import { errorMiddleware, docs } from '../src/middleware'
|
||||
|
||||
const app = new Koa()
|
||||
app.keys = [config.session]
|
||||
@@ -19,9 +18,9 @@ app.use(convert(logger()))
|
||||
app.use(convert(bodyParser()))
|
||||
app.use(convert(session()))
|
||||
app.use(errorMiddleware())
|
||||
app.use(convert(serve(`${process.cwd()}/docs/`)))
|
||||
app.use(docs())
|
||||
|
||||
require('./passport')
|
||||
require('../config/passport')
|
||||
app.use(passport.initialize())
|
||||
app.use(passport.session())
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Router from 'koa-router'
|
||||
import passport from 'koa-passport'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import config from '../../config/config'
|
||||
import config from '../../config'
|
||||
|
||||
const router = new Router({ prefix: '/auth' })
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Router from 'koa-router'
|
||||
import User from '../models/users'
|
||||
import config from '../../config/config'
|
||||
import config from '../../config'
|
||||
import jwt from 'jsonwebtoken'
|
||||
import { ensureUser } from '../middleware/validators'
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import convert from 'koa-convert'
|
||||
import serve from 'koa-static'
|
||||
|
||||
export function errorMiddleware() {
|
||||
return async (ctx, next) => {
|
||||
try {
|
||||
@@ -9,3 +12,13 @@ export function errorMiddleware() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function docs() {
|
||||
return async (ctx, next) => {
|
||||
if(ctx.path !== '/docs') {
|
||||
return next()
|
||||
}
|
||||
|
||||
await convert(serve(`${process.cwd()}/docs/`))();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user