38 lines
664 B
JavaScript
38 lines
664 B
JavaScript
import { stub } from 'eltro'
|
|
import Client from './helper.client.mjs'
|
|
import defaults from '../api/defaults.mjs'
|
|
import serv from '../api/server.mjs'
|
|
|
|
serv.log = {
|
|
log: stub(),
|
|
warn: stub(),
|
|
info: stub(),
|
|
error: stub(),
|
|
}
|
|
|
|
export const server = serv
|
|
|
|
export function createClient() {
|
|
return new Client()
|
|
}
|
|
|
|
export function resetLog() {
|
|
serv.log.log.reset()
|
|
serv.log.info.reset()
|
|
serv.log.warn.reset()
|
|
serv.log.error.reset()
|
|
}
|
|
|
|
export function createContext(opts) {
|
|
return defaults(opts, {
|
|
query: new Map(),
|
|
req: { },
|
|
res: { },
|
|
log: {
|
|
log: stub(),
|
|
warn: stub(),
|
|
info: stub(),
|
|
error: stub(),
|
|
},
|
|
})
|
|
}
|