Slides and code for Liferay's /dev/24 talk by Javier Gamarra.
The idea is to a simple TikTok clone like this:
-> Tested in 7.3 but Headless code is backported to 7.2 and 7.1.
- Launch your Liferay instance
- Clone this repo and launch npm i
- Run npm start and Play! :)
- Learn the existing APIs with /o/api && /o/openapi and the documentation
- Show and create GIFs with the REST APIs
- Use GraphQL
- Installing Apollo: npm install @apollo/client graphql
- Create an Apollo client
- Use useQuery
- Embed image with NestedFields & 'data:video/mp4;base64,'
- Conditionally render elements of the UI based on backend permissions with actions
- Store and retrieve documents and web contents in the new Asset libraries
- Return any asset with ContentElements API
- Transform your results with filter, search, sort and flatten
- Return or create all translations & window.navigator.language from chrome://settings/languages#lang
- Aggregate information with facets
- Improve performance -> fields && restrictFields
- Disable endpoints in headless settings
- Add new fields using WebContent or RelatedContents or CustomFields -> API extensibility
- Let's define our API, REST Builder
- Batch framework
- More GraphQL relationships (children, parent, element)
- Headless Admin Content
- APIs: New APIs or improvements: document types & metadata, navigation menus, move documents...
- Vulcan: Automatic transactions, contextProviders, Bean Validation, Multipart...
- REST Builder: Permissions endpoints (& ViewableBy)
- Headless: Many more things... Java client, versioned GraphQL endpoint...
Remember that you don't have to wait for 7.4, we do rolling releases!
- New identifier for APIs
- Webhooks
- Server side events/GraphQL subscriptions
- Layouts/Pages API
- Admin APIs
- Lazy fields
- YOUR IDEA
- ...
- ...
- ...
- How do I filter? -> see here. OData syntax is complex, so ask us in the community slack.
- Liferay API Versioning? -> we won't break (again, sorry) the existing APIs at least until 7.4.
- Auth, if I'm serving the application outside Liferay? -> same as Liferay Portal, whatever you are using there like OAuth, Basic Auth, Session, but recommended is OAuth.
- Service Access Quotas? -> interesting, ping us! (you can use an API Gateway but we can talk).
- CORS? -> yeah, default for GraphQL but has to be configured for APIs. Remember/understand what CORS is or should: a configuration only for development because you are using different IPs in a browser request. Doesn't apply if we serve portlets, and it's a dev issue, should not be a production issue.
- http://bit.ly/headless24 Slides!
- Headless channel in Liferay Community Slack
- OLD Headless APIs documentation
- New Liferay Learn documentation
- SwaggerHub (but use /o/api)
- TikTok React template from CleverProgrammers
- Sample videos from Vertical Video: Current State of the Art
- Sample TikToks by:
- malinoisdog, "Like watching the plot, still like watching me fly #dog #fly #fyp", Wrecking Ball(fast ver.) - Miley Cyrus
- charlidamelio, "THANK YOU ALL SO SO SO MUCH FOR 86 MILLION!!!! @mishagabriel @rexkline @breakthefloor", Move Ya Hips - A$AP Ferg
- guille_what, "¿Cuantos metros crees que son?🚀", Obnimi - Callmearco Remix - mattia
- thesupercole, "Savannah might’ve gone into labor making this...🤰🏼 ", Love Story Discolines - EthanIsHung
- youneszarou, "Is this insane? #yzfamily #foryoupage #fürdich #fyp", Still Don't Know My Name - Labrinth