We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c2b55c8 commit 66e4ee7Copy full SHA for 66e4ee7
2 files changed
api.js
@@ -1,8 +1,15 @@
1
+import { json } from 'body-parser'
2
+
3
export default [
4
{
5
path: '/api/ping',
6
handler(req, res, next) {
7
res.end(`API pong at ${new Date().getTime()}`)
8
}
9
+ },
10
+ json(),
11
+ (req, res, next) => {
12
+ res.json = (obj) => res.write(JSON.stringify(obj))
13
+ next()
14
15
]
package.json
@@ -18,6 +18,7 @@
18
"nuxt": "^2.6.3"
19
},
20
"dependencies": {
21
- "@nuxt/http": "^0.1.1"
+ "@nuxt/http": "^0.1.1",
22
+ "body-parser": "^1.19.0"
23
24
0 commit comments