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