System Information
- Strapi Version: v4.13.2
- Operating System: Ventura 13.5.2
- Database: MySQL
- Node Version: v18.17.1
- NPM Version: 9.6.7
- Yarn Version: na
In AstroJS (I’m new) I’m able to retrieve my full Strapi table data using these lines of code:
const response = await fetch("http://127.0.0.1:1337/api/teams?populate=");*
const { data } = await response.json();
Or using the Filters option to get a specific result eg
http://127.0.0.1:1337/api/teams?filters[name][$contains]=john;
const { data } = await response.json();
Both above is placed in JSON data.
I would like to use the finOne function that Strapi has in their documentation.
const entry = await strapi.db.query(‘api::blog.article’).findOne({
- select: [‘title’, ‘description’],*
- where: { title: ‘Hello World’ },*
- populate: { category: true },*
});
- My first question is what is api:::blog.artilce? I only have Strapi table names like Content and Teams.
- My second question is why am I getting a error “strapi is not defined” when changing the api to my teams table?
const entry = await strapi.db.query(‘http://127.0.0.1:1337/api/teams’).findOne({
- select: [‘title’, ‘name’],*
- where: { name: ‘john’ },*
- populate: { category: true },*
});