Skip to content

Commit

Permalink
Fix issues found in linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-abbott committed Feb 18, 2022
1 parent a1e2b95 commit 04f8e8e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/custom-server-hapi/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"watch": ["server"],
"exec": "ts-node --project tsconfig.server.json server/server.ts",
"ext": "js ts"
}
}
24 changes: 11 additions & 13 deletions examples/custom-server-hapi/server/next-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import type {NextServer} from "next/dist/server/next"
import type {Lifecycle} from "@hapi/hapi";
import type {NextUrlWithParsedQuery} from "next/dist/server/request-meta";
import type { NextServer } from 'next/dist/server/next'
import type { Lifecycle } from '@hapi/hapi'
import type { NextUrlWithParsedQuery } from 'next/dist/server/request-meta'

const nextHandlerWrapper = (app: NextServer): Lifecycle.Method => {
const handler = app.getRequestHandler()
const handler = app.getRequestHandler()

return async ({ raw, url, query }, h) => {
const nextUrl = url as unknown as NextUrlWithParsedQuery
nextUrl.query = query
await handler(raw.req, raw.res, nextUrl)
return h.close
}
return async ({ raw, url, query }, h) => {
const nextUrl = url as unknown as NextUrlWithParsedQuery
nextUrl.query = query
await handler(raw.req, raw.res, nextUrl)
return h.close
}
}

export {
nextHandlerWrapper
}
export { nextHandlerWrapper }
2 changes: 1 addition & 1 deletion examples/custom-server-hapi/server/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import next from 'next'
import Hapi from '@hapi/hapi'
import {nextHandlerWrapper} from './next-wrapper'
import { nextHandlerWrapper } from './next-wrapper'

const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
Expand Down
10 changes: 2 additions & 8 deletions examples/custom-server-hapi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion examples/custom-server-hapi/tsconfig.server.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"noEmit": false
},
"include": ["server/**/*.ts"]
}
}
2 changes: 1 addition & 1 deletion readme.md

0 comments on commit 04f8e8e

Please sign in to comment.