Service discovery, Log & Trace module
- Add
/ping
route - Add Request Logger
- Add Datadog Tracer
- Inject special header to NuAPI client
- Add
@privyid/pong
dependency to your project
yarn add --dev @privyid/pong
- Add
@privyid/pong
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'@privyid/pong'
]
})
That's it! You can now use Pong in your Nuxt app ✨
If you using datadog, don't forget to set these ENV to make sure tracer work properly:
DD_ENV= # App enviroment, ex: development-cartenzs or production-cartensz
DD_SERVICE= # Your service name, ex: cartensz-web-app
DD_VERSION= # (Optional) Your service version, ex: 1.0.0
By default, Pong not trace any requests / responses's body because it might be interupting data flow in proxy. But if you can enable it by following this steps:
- Enable in your
nuxt.config.ts
export default defineNuxtConfig({
// ...
pong: {
// ...
traceReqBody: true,
traceResBody: true,
// ...
},
})
- Replace import from
@privyid/nhp/core
to@privyid/pong/nhp
in yourserver.config.ts
-import { defineServer } from '@privyid/nhp/core'
+import { defineServer } from '@privyid/pong/nhp'
export default defineServer([
{
name : 'example',
baseUrl : '/api/example',
targetUrl: 'https://reqres.in/api/',
},
])
- Clone this repository
- Play Nyan Cat in the background (really important!)
- Enable Corepack using
corepack enable
(usenpm i -g corepack
for Node.js < 16.10) - Run
yarn install
- Run
yarn dev:prepare
to generate type stubs. - Use
yarn dev
to start playground in development mode.