
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
jelenjs-router
Advanced tools
File-based routing for JelenJS framework, inspired by Next.js routing conventions.
npm install jelenjs-router
import { createApp } from 'jelenjs';
import { Router } from 'jelenjs-router';
function App() {
return <Router />;
}
createApp(App, '#app');
Create your pages in a pages/
directory:
pages/
├── index.tsx # / route
├── about.tsx # /about route
├── blog/
│ ├── index.tsx # /blog route
│ └── [slug].tsx # /blog/:slug route
└── users/
└── [id].tsx # /users/:id route
// pages/blog/[slug].tsx
import type { PageProps } from 'jelenjs-router';
export default function BlogPost({ params, query, navigate }: PageProps) {
return (
<div>
<h1>Blog Post: {params.slug}</h1>
<p>Query: {JSON.stringify(query)}</p>
<button onClick={() => navigate('/blog')}>
Back to Blog
</button>
</div>
);
}
File Path | Route | Description |
---|---|---|
pages/index.tsx | / | Home page |
pages/about.tsx | /about | Static route |
pages/blog/index.tsx | /blog | Nested static route |
pages/blog/[slug].tsx | /blog/:slug | Dynamic route |
pages/users/[id].tsx | /users/:id | Dynamic route |
pages/[...slug].tsx | /*slug | Catch-all route |
import { Link } from 'jelenjs-router';
function Navigation() {
return (
<nav>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/blog/my-post">Blog Post</Link>
</nav>
);
}
import { useRouter } from 'jelenjs-router';
function MyComponent() {
const router = useRouter();
const handleClick = () => {
router.navigate('/about');
};
return <button onClick={handleClick}>Go to About</button>;
}
Get current route parameters:
import { useParams } from 'jelenjs-router';
function BlogPost() {
const params = useParams(); // { slug: "my-post" }
return <h1>Post: {params.slug}</h1>;
}
Get current query parameters:
import { useQuery } from 'jelenjs-router';
function SearchPage() {
const query = useQuery(); // { q: "search term" }
return <p>Searching for: {query.q}</p>;
}
Get router utilities:
import { useRouter } from 'jelenjs-router';
function MyComponent() {
const router = useRouter();
return (
<div>
<button onClick={() => router.navigate('/home')}>Home</button>
<button onClick={() => router.back()}>Back</button>
<button onClick={() => router.forward()}>Forward</button>
</div>
);
}
When using with jelenjs-vite
, the router will automatically discover your page files:
// vite.config.js
import { defineConfig } from 'vite';
import jelenjs from 'jelenjs-vite';
export default defineConfig({
plugins: [
jelenjs({
router: {
enabled: true,
pagesDir: 'src/pages'
}
})
]
});
You can also register routes manually without file-based routing:
import { Router, createRoute } from 'jelenjs-router';
function HomePage() {
return <div>Home</div>;
}
function AboutPage() {
return <div>About</div>;
}
function App() {
const routes = [
createRoute('/', HomePage),
createRoute('/about', AboutPage)
];
return <Router routes={routes} />;
}
MIT
FAQs
File-based router for JelenJS framework
The npm package jelenjs-router receives a total of 1 weekly downloads. As such, jelenjs-router popularity was classified as not popular.
We found that jelenjs-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.