load api files through a remix route
This commit is contained in:
2
packages/website/.gitignore
vendored
2
packages/website/.gitignore
vendored
@@ -4,7 +4,7 @@ node_modules
|
|||||||
/build
|
/build
|
||||||
/public/build
|
/public/build
|
||||||
.env
|
.env
|
||||||
/public/api
|
/public/api-dist
|
||||||
cypress/videos
|
cypress/videos
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
*.out.css
|
*.out.css
|
||||||
|
|||||||
7
packages/website/app/routes/api.$.tsx
Normal file
7
packages/website/app/routes/api.$.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import type { LoaderFunction } from "remix"
|
||||||
|
|
||||||
|
// loading the api through a resource route lets us receive analytics and remix server logs for api pages
|
||||||
|
export const loader: LoaderFunction = ({ request, params }) => {
|
||||||
|
const url = new URL("/", request.url)
|
||||||
|
return fetch(`${url.toString()}/api-dist/${params["*"]}`)
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"entryPoints": ["../reacord/library/main.ts"],
|
"entryPoints": ["../reacord/library/main.ts"],
|
||||||
"out": ["public/api"],
|
"out": ["public/api-dist"],
|
||||||
"tsconfig": "../reacord/tsconfig.json",
|
"tsconfig": "../reacord/tsconfig.json",
|
||||||
"excludeInternal": true,
|
"excludeInternal": true,
|
||||||
"excludePrivate": true,
|
"excludePrivate": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user