-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
// https://github.com/whitep4nth3r/p4nth3rblog/blob/main/contentful/Events.js import ContentfulApi from "@contentful/Api"; const defaultOptions = { future: true, }; /* * Get all events -- future by default */ static async getEvents(options = defaultOptions) { // Calculate date_ASC for future events, or date_DESC for past events const order = options.future ? "date_ASC" : "date_DESC"; // Generate today's date const date = new Date(); // And format it to an ISO String const formattedDate = date.toISOString(); // Decide on the date filter to pass in as a string const dateFilter = options.future ? "date_gt" : "date_lt"; // Construct variables object to send with the HTTP POST request const variables = { date: formattedDate, order }; // Build the query const query = `query GetEvents($date: DateTime!, $order: [EventOrder]!) { eventCollection(where: {${dateFilter}: $date}, order: $order) { items { sys { id } date name link description timeTbc isVirtual image { url description height width } } } }`; // Call out to the base API call const response = await this.callContentful(query, variables); const eventCollection = response.data.eventCollection.items ? response.data.eventCollection.items : []; return eventCollection; }
Related posts
-
How to load responsive images in AVIF and WebP using the HTML <picture> element
-
Created Frontend Tools Showcase site with Next.js & Contentful
-
How to add Algolia InstantSearch to your Next.js application
-
How to filter entries by linked references in GraphQL
-
Show HN: Replexica – AI-powered internationalization compiler for React (+ API)