Basic Usage

Fetch all items from a database:
const [posts, error] = await nc.query.blog.list();

if (!error) {
  posts.forEach(post => {
    console.log(post.title);
  });
}

Type Safety

NotCMS provides full type inference for list results:
// Infer array type
type BlogPosts = typeof nc.query.blog.$inferPages;

// Use in your functions
function processPosts(posts: BlogPosts) {
  posts.forEach(post => {
    // Full type safety and IDE autocomplete
    console.log(post.title);
    console.log(post.published);
  });
}

Next Steps