Skip to content

Commit 66ca777

Browse files
committed
Updates for HDB API
1 parent 3303e20 commit 66ca777

File tree

2 files changed

+48
-23
lines changed

2 files changed

+48
-23
lines changed

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts

resources.js

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
const { parse } = require('url')
22
const next = require('next')
3-
4-
const dev = process.env.NODE_ENV !== 'production'
3+
4+
// currently non-dev mode throws errors about missing .next/BUILD_ID and manifest file
5+
const dev = true;//process.env.NODE_ENV !== 'production'
56
const app = next({ dev, dir: __dirname })
67
const handle = app.getRequestHandler()
7-
8-
app.prepare().then(() => {
9-
console.log('prepared')
10-
server.http(async (request) => {
11-
try {
12-
const req = request.nodeRequest;
13-
const res = request.nodeResponse;
14-
// Be sure to pass `true` as the second argument to `url.parse`.
15-
// This tells it to parse the query portion of the URL.
16-
const parsedUrl = parse(req.url, true)
17-
await handle(req, res, parsedUrl)
18-
return {
19-
done: true,
20-
}
21-
} catch (err) {
22-
console.error('Error occurred handling', req.url, err)
23-
res.statusCode = 500
24-
res.end('internal server error')
25-
}
26-
});
27-
});
8+
9+
app.prepare(); // This returns a promise, we could maybe await this
10+
server.http((request) => {
11+
const req = request._nodeRequest;
12+
const res = request._nodeResponse;
13+
// Be sure to pass `true` as the second argument to `url.parse`.
14+
// This tells it to parse the query portion of the URL.
15+
const parsedUrl = parse(req.url, true)
16+
return handle(req, res, parsedUrl)
17+
});

0 commit comments

Comments
 (0)