reverse proxy for uploads
This commit is contained in:
parent
0eb91d67dd
commit
ce50f8a6d6
8 changed files with 44 additions and 48 deletions
|
|
@ -1,31 +1,33 @@
|
|||
import { strapi, type StrapiClient } from "@strapi/client";
|
||||
import { strapi, type StrapiClient } from '@strapi/client';
|
||||
|
||||
export class Strapi {
|
||||
public readonly api: string;
|
||||
public readonly uploads: string;
|
||||
|
||||
private readonly client: StrapiClient;
|
||||
|
||||
constructor(
|
||||
public readonly url: string,
|
||||
auth: string,
|
||||
) {
|
||||
constructor(url: string, auth: string) {
|
||||
this.api = `${url}/api`;
|
||||
this.uploads = `${url}/uploads`;
|
||||
this.client = strapi({
|
||||
baseURL: `${url}/api`,
|
||||
auth: auth,
|
||||
baseURL: this.api,
|
||||
auth: auth
|
||||
});
|
||||
}
|
||||
|
||||
async Blogs() {
|
||||
const blogs = this.client.collection("blogs");
|
||||
const blogs = this.client.collection('blogs');
|
||||
|
||||
return await blogs.find({
|
||||
populate: ["Header", "Topics"],
|
||||
populate: ['Header', 'Topics']
|
||||
});
|
||||
}
|
||||
|
||||
async Blog(id: string) {
|
||||
const blogs = this.client.collection("blogs");
|
||||
const blogs = this.client.collection('blogs');
|
||||
|
||||
return await blogs.findOne(id, {
|
||||
populate: ["Header", "Topics"],
|
||||
populate: ['Header', 'Topics']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue