Snippets

Code snippets that can be easily implemented via copy/paste. These don't dwell on the why or how, just implementation.

AdonisJS
Lucid

Accessing Lucid's Knex Connection Client

Ever need to directly access KnexJS, the query builder Lucid wraps around? Here's how you can do it!

Tailwind

Disable Tailwind CSS Hover States on Tap Devices

Did you know you can quickly and easily disable Tailwind's hover state classes on tap devices, like phones and tablets?

Components
Tailwind
AdonisJS

Simple AdonisJS 6 Layout Component

With AdonisJS 6, layouts have been removed in favor of components. In this snippet, we provide a simple layout component example.

AdonisJS

Get User IP Address when Server is Proxied by Cloudflare

If your server is proxied by Cloudflare, chances are the built-in method to get the user IP Address in AdonisJS is returning Cloudflare's IP instead of your users. With this snippet, we'll fix that!

Lucid
AdonisJS

Using Transaction Events To Defer Actions

We can bind handlers to transaction events to easily defer specific actions until after the transaction has been committed and our changes have persisted to the database.

Router
AdonisJS

Require Route Parameter To Start With @ To Match

You can use route matchers to specify requirements on the route parameter. In this snippet, we require our username param to start with the @ character for the route to match.

Showing 1 to 6 of 6 results

Filter

Filter by topic