nuxt-routing/
│
├── app.vue
│
├── nuxt.config.ts
│
├── layouts/
│   └── default.vue
│
├── pages/
│   ├── index.vue
│   ├── about.vue
│   ├── contact.vue
│   │
│   └── students/
│       └── [id].vue
│
└── package.json

layouts/default.vue:
<template>
  <div>
    <header class="navbar">
      <h2>Student Portal</h2>

      <nav>
        <NuxtLink to="/">Home</NuxtLink>
        <NuxtLink to="/about">About</NuxtLink>
        <NuxtLink to="/contact">Contact</NuxtLink>
        <NuxtLink to="/students/101">Student</NuxtLink>
      </nav>
    </header>

    <main>
      <slot />
    </main>

    <footer>
      <p>Nuxt Routing Practical | Student Portal</p>
    </footer>
  </div>
</template>

<style>
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f7fb;
}

.navbar {
  background: #2563eb;
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.navbar h2 {
  margin: 0;
}

nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

nav a {
  color: white;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

main {
  min-height: 70vh;
  padding: 30px;
}

footer {
  background: #1e293b;
  color: white;
  padding: 15px;
  text-align: center;
}
</style>
app.vue:
<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
</template>

pages/index.vue:
<template>
  <section>
    <h1>Welcome to Student Portal</h1>

    <p>
      This project demonstrates routing and shared layouts in Nuxt.
    </p>

    <h3>Available Pages</h3>

    <ul>
      <li>Home Page</li>
      <li>About Page</li>
      <li>Contact Page</li>
      <li>Dynamic Student Details Page</li>
    </ul>

    <NuxtLink to="/about" class="button">
      Explore About Page
    </NuxtLink>
  </section>
</template>

<style scoped>
h1 {
  color: #2563eb;
}

.button {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 18px;
  background: #2563eb;
  color: white;
  text-decoration: none;
  border-radius: 6px;
}
</style>

pages/about.vue:
<template>
  <section>
    <h1>About Us</h1>

    <p>
      This Student Portal is developed using Nuxt.
    </p>

    <p>
      It demonstrates file-based routing and reusable layouts.
    </p>

    <NuxtLink to="/">Return to Home</NuxtLink>
  </section>
</template>
pages/contact.vue:
<template>
  <section>
    <h1>Contact Us</h1>

    <p>Email: student@example.com</p>

    <p>Phone: 9876543210</p>

    <NuxtLink to="/">Return to Home</NuxtLink>
  </section>
</template>

pages/students/[id].vue :
<script setup lang="ts">
const route = useRoute()

const studentId = computed(() => route.params.id)
</script>

<template>
  <section>
    <h1>Student Details</h1>

    <p>
      Student ID: {{ studentId }}
    </p>

    <p>
      This page displays student details based on the URL parameter.
    </p>

    <NuxtLink to="/">Return to Home</NuxtLink>
  </section>
</template>

