Skip to content

Instantly share code, notes, and snippets.

View abdoulmouctard's full-sized avatar
🎯
Focusing

Mouctar DIALLO abdoulmouctard

🎯
Focusing
View GitHub Profile
@abdoulmouctard
abdoulmouctard / router.ts
Created July 14, 2023 15:54
vue js middleware
import { createRouter, createWebHistory } from 'vue-router'
import routes from '../routes'
const router = createRouter({
history: createWebHistory('/app'),
routes,
})
const middlewarePipeline = (context, middleware, index) => {
import { App, defineAsyncComponent } from 'vue'
// Function to convert a string to kebab case
const toKebabCase = (str) =>
str
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/\s+/g, '-')
.toLowerCase()
// Dynamically register components by scanning the components directory