Skip to content

Commit

Permalink
fix: 修复默认port失效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
limengke123 committed Jul 17, 2019
1 parent d92eabe commit d95b67e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface serverOption {
interfaceName?: string
}

const defaultOption: option = {
export const defaultOption: option = {
baseOption: {
mockPath: './mock'
},
Expand Down
7 changes: 5 additions & 2 deletions src/tasks/server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import * as jsonServer from 'json-server'
import { optionTuple } from '../index'
import {defaultOption, optionTuple} from '../index'
import { success } from '../util/commonUtil'

export const startServer = ([option, [dataPath, schemaNames]]: optionTuple<[string, string[]]>) => {
const { serverOption } = option
const { port } = serverOption!
let { port } = serverOption!
if (!port) {
port = defaultOption.serverOption!.port
}
const app = jsonServer.create()
const router = jsonServer.router(dataPath)
const middleware = jsonServer.defaults()
Expand Down

0 comments on commit d95b67e

Please sign in to comment.