feat: Upgrade template based on projects made with it
Some checks failed
Build, check & Test / run (push) Failing after 42s

Signed-off-by: Florian Bouillon <f.bouillon@aptatio.com>
This commit is contained in:
2023-10-09 11:47:11 +02:00
parent bf06e41238
commit e26b4eb4a5
42 changed files with 934 additions and 136 deletions

23
src/pages/api/event.ts Normal file
View File

@ -0,0 +1,23 @@
import type { APIRoute } from 'astro'
import ResponseBuilder from '../../libs/ResponseBuilder'
/**
* Plausible proxy
*/
export const POST: APIRoute = async ({ request, clientAddress }) => {
// const body = await request.json()
// console.log(body, clientAddress)
const res = await fetch('https://plausible.io/api/event', {
method: 'POST',
headers: {
'User-Agent': request.headers.get('User-Agent') as string,
'X-Forwarded-For': clientAddress,
'Content-Type': 'application/json'
},
body: await request.text()
})
return new ResponseBuilder()
.status(res.status)
.body(await res.text())
.build()
}