Adocasts Plus Timed Exclusive

Please check back in 1 day. Get immediate access to this lesson and more by joining Adocasts Plus for $8.00/mo or signing into your existing Adocasts+ account.

robot mascot smiling

EdgeJS Templating Basics

In this lesson, we'll learn the basics of AdonisJS's homegrown template engine EdgeJS. We'll cover interpolation, conditional statements, looping, variables, state, and more!

Published
Feb 10
Duration
8m 49s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Adocasts Plus Timed Exclusive

Please check back in 1 day. Get immediate access to this lesson and more by joining Adocasts Plus for $8.00/mo or signing into your existing Adocasts+ account.

Join The Discussion! (5 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 3 days ago

    Hi, I am getting the Cannot lookup rote Edge error when I try to use an edge template with the route() helper in it.

          Error: Cannot lookup route "moms.join"
              at anonymous (D:\www\seeds\resources\views\moms\pages\home.edge:95:0)
    <a class='button' href="{{ route('moms.join') }}">

    That route shows up in list:routes:
    GET /join (moms.join) .................................................. #controllers/join_controller.join

    What am I doing wrong? Please let me know what additional information is needed.

    Thank you.

    0

    Please sign in or sign up for free to reply

    1. Commented 3 days ago

      I should probably add that the 'moms' at the start of that route name is for a domain:

      router
        .group(() => {
          router.get('/join', [JoinController, 'join']).as('join')
        })
        .domain('moms.test')
        .as('moms')
      
      1

      Please sign in or sign up for free to reply

      1. Commented 2 days ago

        I haven't yet worked with subdomains in AdonisJS 6, but I believe they work the same as in v5. When building the route's url using the route() method, the third argument accepts the domain.

        <a href="{{ route('moms.join', {}, { domain: 'moms.test' }) }}">
          My Link
        </a>
        Copied!

        The subdomain behavior is siloed, so you can have the same route defined outside the subdomain as well, and they can also be dynamic. Due to these reasons, that's why the domain will need specified when you're specifically looking to build a route for that domain.

        Hope this helps!

        0

        Please sign in or sign up for free to reply

        1. Commented 2 days ago

          Wow thanks. I did not get that from the documentation anywhere. Hey, question: Do you know of any full-featured V6 example site on Github? It would be soooo helpful to see a full example of all this stuff, service providers, the container, everything.

          0

          Please sign in or sign up for free to reply

          1. Commented 2 days ago

            Anytime!! This site is public on GitHub and uses AdonisJS 6
            https://github.com/adocasts/adocasts

            Beyond that, I'm not aware of any that are currently public.

            0

            Please sign in or sign up for free to reply