# neru

> Neru is a small and lightweight file router for your favourite backends

Latest version **1.0.2** (published 2023-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install neru
pnpm add neru
yarn add neru
bun add neru
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-08-19 |
| First published | 2021-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 30.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | GHOST |
| Maintainers | ghostsos |

## Links

- npm: https://www.npmjs.com/package/neru
- Repository: https://github.com/ghostdevv/neru
- Issues: https://github.com/ghostdevv/neru
- npm.io page: https://npm.io/package/neru

## Dependencies (5)

- [kleur](https://npm.io/package/kleur.md) ^4.1.5
- [totalist](https://npm.io/package/totalist.md) ^3.0.0
- [consolite](https://npm.io/package/consolite.md) ^0.3.11
- [ghoststools](https://npm.io/package/ghoststools.md) ^0.6.3
- [@nerujs/methods](https://npm.io/package/@nerujs/methods.md) 1.0.3

## Recent versions

- 1.0.2 (latest) — 2023-08-19
- 1.0.1 — 2023-04-26
- 1.0.0 — 2023-01-26
- 0.9.0 — 2022-06-20
- 0.8.5 — 2022-06-06
- 0.8.4 — 2022-06-03
- 0.8.3 — 2022-05-27
- 0.8.2 — 2022-05-24
- 0.8.1 — 2022-04-22
- 0.8.0 — 2022-04-16
- 0.7.1 — 2022-03-21
- 0.7.0 — 2022-03-16
- 0.6.6 — 2022-03-06
- 0.6.5 — 2022-02-28
- 0.6.4 — 2021-12-19
- … 8 more at https://npm.io/package/neru/versions

## README

# Neru

The fast and lightweight **file-based router** for [Hapi](https://github.com/hapijs/hapi), [Express](https://github.com/expressjs/express), and [Fastify](https://www.fastify.io/) (more coming soon!). Neru allows you to easily organise and manage your project by it's file system whilst keeping the framework you love.

# Quick Start

You can get started by creating your Neru project:

```bash
npm init neru my-project
```

Checkout our [guide](https://www.neru.dev/guide/) which will show you how neru works!

# Documentation & Discord Help

- [Documentation](https://neru.dev/)
- [Discord](https://discord.gg/2Vd4wAjJnm)

# Adapters

Adapters allow you to use neru with your favourite framework.  Get started with the ones below or [suggest a new one to be added next](https://github.com/ghostdevv/neru/issues/new).

| Adapter | Package                                             | Documentation                                       | Changelog                                          |
|---------|-----------------------------------------------------|-----------------------------------------------------|----------------------------------------------------|
| Hapi    | [@nerujs/adapter-hapi](packages/adapter-hapi)       | [Documentation](packages/adapter-hapi/README.md)    | [Changelog](packages/adapter-hapi/CHANGELOG.md)    |
| Express | [@nerujs/adapter-express](packages/adapter-express) | [Documentation](packages/adapter-express/README.md) | [Changelog](packages/adapter-express/CHANGELOG.md) |

# Add neru yourself

It only takes a few easy steps!

## Installing

Install `neru` and your `adapter` of choice.  Look below for a list of adapters.  In this example, we will use express.

```bash
npm i neru @nerujs/express express
```

## Setup

Now that we have Neru and our adapter installed, we can run Neru and pass in our `express server`, `adapter`, and `routes` directory.

```js
import { adapter } from '@nerujs/express';
import express from 'express';
import { neru } from 'neru';

const server = express();

await neru({
    adapter,
    server,
    routes: 'src/routes',
});

server.listen(3000, () => console.log('Online on port 3000'));
```

## Creating a route

In our `src/routes` directory, we can create an index route.  This will correspond to `/` on our server. In that file we can export an express route handler.

```js
export const GET = (req, res) => {
    res.send('Hello World');
}
```

There's also an optional `route` function exported by most adapters that provides type completion:

```js
import { route } from '@nerujs/express';

export const GET = route((req, res) => {
    res.send('Hello World');
})
```

# Adapters

| Adapter | Package                                             | Documentation                                       | Changelog                                          |
|---------|-----------------------------------------------------|-----------------------------------------------------|----------------------------------------------------|
| Hapi    | [@nerujs/adapter-hapi](packages/adapter-hapi)       | [Documentation](packages/adapter-hapi/README.md)    | [Changelog](packages/adapter-hapi/CHANGELOG.md)    |
| Express | [@nerujs/adapter-express](packages/adapter-express) | [Documentation](packages/adapter-express/README.md) | [Changelog](packages/adapter-express/CHANGELOG.md) |

---
_Source: https://npm.io/package/neru · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
