{"pageProps":{"snippets":[{"name":"Express.js","order":1,"source":{"compiledSource":"var i=Object.defineProperty,N=Object.defineProperties;var d=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var r=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var c=(e,s,p)=>s in e?i(e,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[s]=p,a=(e,s)=>{for(var p in s||(s={}))r.call(s,p)&&c(e,p,s[p]);if(t)for(var p of t(s))l.call(s,p)&&c(e,p,s[p]);return e},o=(e,s)=>N(e,d(s));var m=(e,s)=>{var p={};for(var n in e)r.call(e,n)&&s.indexOf(n)<0&&(p[n]=e[n]);if(e!=null&&t)for(var n of t(e))s.indexOf(n)<0&&l.call(e,n)&&(p[n]=e[n]);return p};const layoutProps={},MDXLayout=\"wrapper\";function MDXContent(p){var n=p,{components:e}=n,s=m(n,[\"components\"]);return mdx(MDXLayout,o(a(a({},layoutProps),s),{components:e,mdxType:\"MDXLayout\"}),mdx(\"p\",null,\"Install with yarn:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-sh\"}),`yarn add @apilytics/express\n`)),mdx(\"p\",null,\"Install with npm:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-sh\"}),`npm install @apilytics/express\n`)),mdx(\"p\",null,\"Usage:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-javascript\"}),mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-comment\"}),\"// server.js\"),`\n\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"const\"),\" { apilyticsMiddleware } = \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-built_in\"}),\"require\"),\"(\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-string\"}),\"'@apilytics/express'\"),`);\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"const\"),\" express = \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-built_in\"}),\"require\"),\"(\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-string\"}),\"'express'\"),`);\n\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"const\"),\" app = \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-title hljs-function\"}),\"express\"),`();\n\napp.`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-title hljs-function\"}),\"use\"),\"(\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-title hljs-function\"}),\"apilyticsMiddleware\"),\"(process.\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-property\"}),\"env\"),\".\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-property\"}),\"APILYTICS_API_KEY\"),`));\n`)))}MDXContent.isMDXComponent=!0;\n","scope":{}}},{"name":"Next.js","order":2,"source":{"compiledSource":"var N=Object.defineProperty,d=Object.defineProperties;var h=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var l=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;var c=(e,s,p)=>s in e?N(e,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[s]=p,a=(e,s)=>{for(var p in s||(s={}))l.call(s,p)&&c(e,p,s[p]);if(t)for(var p of t(s))r.call(s,p)&&c(e,p,s[p]);return e},o=(e,s)=>d(e,h(s));var m=(e,s)=>{var p={};for(var n in e)l.call(e,n)&&s.indexOf(n)<0&&(p[n]=e[n]);if(e!=null&&t)for(var n of t(e))s.indexOf(n)<0&&r.call(e,n)&&(p[n]=e[n]);return p};const layoutProps={},MDXLayout=\"wrapper\";function MDXContent(p){var n=p,{components:e}=n,s=m(n,[\"components\"]);return mdx(MDXLayout,o(a(a({},layoutProps),s),{components:e,mdxType:\"MDXLayout\"}),mdx(\"p\",null,\"Install with yarn:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-sh\"}),`yarn add @apilytics/next\n`)),mdx(\"p\",null,\"Install with npm:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-sh\"}),`npm install @apilytics/next\n`)),mdx(\"p\",null,\"Usage:\"),mdx(\"pre\",null,mdx(\"code\",a({parentName:\"pre\"},{className:\"hljs language-javascript\"}),mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-comment\"}),\"// pages/api/my-route.js\"),`\n\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"import\"),\" { withApilytics } \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"from\"),\" \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-string\"}),\"'@apilytics/next'\"),`;\n\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"const\"),\" \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-title hljs-function\"}),\"handler\"),\" = \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"async\"),\" (\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-params\"}),\"req, res\"),`) => {\n `,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-comment\"}),\"// ...\"),`\n};\n\n`,mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"export\"),\" \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-keyword\"}),\"default\"),\" \",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-title hljs-function\"}),\"withApilytics\"),\"(handler, process.\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-property\"}),\"env\"),\".\",mdx(\"span\",a({parentName:\"code\"},{className:\"hljs-property\"}),\"APILYTICS_API_KEY\"),`);\n`)))}MDXContent.isMDXComponent=!0;\n","scope":{}}},{"name":"Django","order":3,"source":{"compiledSource":"var m=Object.defineProperty,d=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var o=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var r=(e,a,s)=>a in e?m(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s,n=(e,a)=>{for(var s in a||(a={}))o.call(a,s)&&r(e,s,a[s]);if(t)for(var s of t(a))l.call(a,s)&&r(e,s,a[s]);return e},c=(e,a)=>d(e,y(a));var i=(e,a)=>{var s={};for(var p in e)o.call(e,p)&&a.indexOf(p)<0&&(s[p]=e[p]);if(e!=null&&t)for(var p of t(e))a.indexOf(p)<0&&l.call(e,p)&&(s[p]=e[p]);return s};const layoutProps={},MDXLayout=\"wrapper\";function MDXContent(s){var p=s,{components:e}=p,a=i(p,[\"components\"]);return mdx(MDXLayout,c(n(n({},layoutProps),a),{components:e,mdxType:\"MDXLayout\"}),mdx(\"p\",null,\"Install with pip:\"),mdx(\"pre\",null,mdx(\"code\",n({parentName:\"pre\"},{className:\"hljs language-sh\"}),`pip install apilytics\n`)),mdx(\"p\",null,\"Install with poetry:\"),mdx(\"pre\",null,mdx(\"code\",n({parentName:\"pre\"},{className:\"hljs language-sh\"}),`poetry add apilytics\n`)),mdx(\"p\",null,\"Usage:\"),mdx(\"pre\",null,mdx(\"code\",n({parentName:\"pre\"},{className:\"hljs language-python\"}),mdx(\"span\",n({parentName:\"code\"},{className:\"hljs-comment\"}),\"# settings.py\"),`\n\n`,mdx(\"span\",n({parentName:\"code\"},{className:\"hljs-keyword\"}),\"import\"),` os\n\nAPILYTICS_API_KEY = os.getenv(`,mdx(\"span\",n({parentName:\"code\"},{className:\"hljs-string\"}),'\"APILYTICS_API_KEY\"'),`)\n\nMIDDLEWARE = [\n `,mdx(\"span\",n({parentName:\"code\"},{className:\"hljs-string\"}),'\"apilytics.django.ApilyticsMiddleware\"'),`,\n]\n`)))}MDXContent.isMDXComponent=!0;\n","scope":{}}},{"name":"FastAPI","order":4,"source":{"compiledSource":"var d=Object.defineProperty,i=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var o=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;var l=(a,e,p)=>e in a?d(a,e,{enumerable:!0,configurable:!0,writable:!0,value:p}):a[e]=p,s=(a,e)=>{for(var p in e||(e={}))o.call(e,p)&&l(a,p,e[p]);if(t)for(var p of t(e))r.call(e,p)&&l(a,p,e[p]);return a},c=(a,e)=>i(a,y(e));var m=(a,e)=>{var p={};for(var n in a)o.call(a,n)&&e.indexOf(n)<0&&(p[n]=a[n]);if(a!=null&&t)for(var n of t(a))e.indexOf(n)<0&&r.call(a,n)&&(p[n]=a[n]);return p};const layoutProps={},MDXLayout=\"wrapper\";function MDXContent(p){var n=p,{components:a}=n,e=m(n,[\"components\"]);return mdx(MDXLayout,c(s(s({},layoutProps),e),{components:a,mdxType:\"MDXLayout\"}),mdx(\"p\",null,\"Install with pip:\"),mdx(\"pre\",null,mdx(\"code\",s({parentName:\"pre\"},{className:\"hljs language-sh\"}),`pip install apilytics\n`)),mdx(\"p\",null,\"Install with poetry:\"),mdx(\"pre\",null,mdx(\"code\",s({parentName:\"pre\"},{className:\"hljs language-sh\"}),`poetry add apilytics\n`)),mdx(\"p\",null,\"Usage:\"),mdx(\"pre\",null,mdx(\"code\",s({parentName:\"pre\"},{className:\"hljs language-python\"}),mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-comment\"}),\"# main.py\"),`\n\n`,mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-keyword\"}),\"import\"),` os\n`,mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-keyword\"}),\"from\"),\" apilytics.fastapi \",mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-keyword\"}),\"import\"),` ApilyticsMiddleware\n`,mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-keyword\"}),\"from\"),\" fastapi \",mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-keyword\"}),\"import\"),` FastAPI\n\napp = FastAPI()\n\napp.add_middleware(ApilyticsMiddleware, api_key=os.getenv(`,mdx(\"span\",s({parentName:\"code\"},{className:\"hljs-string\"}),'\"APILYTICS_API_KEY\"'),`))\n`)))}MDXContent.isMDXComponent=!0;\n","scope":{}}},{"name":"Other","order":5,"source":{"compiledSource":"var y=Object.defineProperty,d=Object.defineProperties;var i=Object.getOwnPropertyDescriptors;var t=Object.getOwnPropertySymbols;var p=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var s=(o,e,n)=>e in o?y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n,a=(o,e)=>{for(var n in e||(e={}))p.call(e,n)&&s(o,n,e[n]);if(t)for(var n of t(e))u.call(e,n)&&s(o,n,e[n]);return o},c=(o,e)=>d(o,i(e));var m=(o,e)=>{var n={};for(var r in o)p.call(o,r)&&e.indexOf(r)<0&&(n[r]=o[r]);if(o!=null&&t)for(var r of t(o))e.indexOf(r)<0&&u.call(o,r)&&(n[r]=o[r]);return n};const layoutProps={},MDXLayout=\"wrapper\";function MDXContent(n){var r=n,{components:o}=r,e=m(r,[\"components\"]);return mdx(MDXLayout,c(a(a({},layoutProps),e),{components:o,mdxType:\"MDXLayout\"}),mdx(\"p\",null,`If your backend supports none of our open source middlewares, we have tools to help you with\ncreating your own middleware. See our `,mdx(\"a\",a({parentName:\"p\"},{href:\"/docs/byom\"}),\"docs\"),\" for more information.\"))}MDXContent.isMDXComponent=!0;\n","scope":{}}}]},"__N_SSG":true}