# @loopback/rest

> Expose controllers as REST endpoints and route REST API requests to controller methods

Latest version **15.0.16** (published 2026-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @loopback/rest
pnpm add @loopback/rest
yarn add @loopback/rest
bun add @loopback/rest
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 15.0.16 |
| Published | 2026-08-18 |
| First published | 2017-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 20 \|\| 22 \|\| 24 |
| Dependencies | 31 |
| Unpacked size | 603.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5106 |
| Author | IBM Corp. and LoopBack contributors |
| Maintainers | rfeng, rmg, dhmlau, theprez, frbuceta, marioestradarosa, achrinza |

## Links

- npm: https://www.npmjs.com/package/@loopback/rest
- Repository: https://github.com/loopbackio/loopback-next
- Homepage: https://github.com/loopbackio/loopback-next#readme
- Issues: https://github.com/loopbackio/loopback-next/issues
- npm.io page: https://npm.io/package/@loopback/rest

## Dependencies (31)

- [qs](https://npm.io/package/qs.md) ^6.15.3
- [ajv](https://npm.io/package/ajv.md) ^8.20.0
- [cors](https://npm.io/package/cors.md) ^2.8.6
- [debug](https://npm.io/package/debug.md) ^4.4.3
- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [lodash](https://npm.io/package/lodash.md) ^4.18.1
- [express](https://npm.io/package/express.md) ^4.22.2
- [js-yaml](https://npm.io/package/js-yaml.md) ^4.3.1
- [type-is](https://npm.io/package/type-is.md) ^2.1.0
- [validator](https://npm.io/package/validator.md) ^13.15.35
- [ajv-errors](https://npm.io/package/ajv-errors.md) ^3.0.0
- [@types/cors](https://npm.io/package/@types/cors.md) ^2.8.19
- [ajv-formats](https://npm.io/package/ajv-formats.md) ^3.0.1
- [body-parser](https://npm.io/package/body-parser.md) ^2.3.0
- [http-errors](https://npm.io/package/http-errors.md) ^2.0.1
- [on-finished](https://npm.io/package/on-finished.md) ^2.4.1
- [ajv-keywords](https://npm.io/package/ajv-keywords.md) ^5.1.0
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.25
- [@types/type-is](https://npm.io/package/@types/type-is.md) ^1.6.7
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.3.0
- [@loopback/express](https://npm.io/package/@loopback/express.md) ^8.0.15
- [@types/body-parser](https://npm.io/package/@types/body-parser.md) ^1.19.6
- [@types/http-errors](https://npm.io/package/@types/http-errors.md) ^2.0.5
- [@types/on-finished](https://npm.io/package/@types/on-finished.md) ^2.3.5
- [@types/serve-static](https://npm.io/package/@types/serve-static.md) 2.2.0
- [json-schema-compare](https://npm.io/package/json-schema-compare.md) ^0.2.2
- [@loopback/openapi-v3](https://npm.io/package/@loopback/openapi-v3.md) ^11.0.16
- [strong-error-handler](https://npm.io/package/strong-error-handler.md) ^6.0.1
- [@loopback/http-server](https://npm.io/package/@loopback/http-server.md) ^7.0.15
- [@types/express-serve-static-core](https://npm.io/package/@types/express-serve-static-core.md) ^4.19.9
- [@openapi-contrib/openapi-schema-to-json-schema](https://npm.io/package/@openapi-contrib/openapi-schema-to-json-schema.md) ^5.1.0

## Recent versions

- 15.0.16 (latest) — 2026-08-18
- 0.19.0 (dp3) — 2018-07-20
- 0.7.0 (dp2) — 2018-04-16
- 4.0.0-alpha.10 (dp1) — 2017-11-29
- 15.0.15 — 2026-07-16
- 15.0.14 — 2026-06-11
- 15.0.13 — 2026-05-12
- 15.0.12 — 2026-04-14
- 15.0.11 — 2026-03-11
- 15.0.10 — 2026-02-10
- 15.0.9 — 2026-01-12
- 15.0.8 — 2025-12-09
- 15.0.7 — 2025-11-11
- 15.0.6 — 2025-10-15
- 15.0.5 — 2025-09-10
- … 216 more at https://npm.io/package/@loopback/rest/versions

## README

# @loopback/rest

The REST API package for
[loopback-next](https://github.com/loopbackio/loopback-next).

## Overview

This component provides a REST server for your application instances, complete
with:

- new custom routing engine (special thanks to @bajtos)!
- tools for defining your application routes
- OpenAPI 3.0 spec (`openapi.json`/`openapi.yaml`) generation using
  `@loopback/openapi-v3`
- a default sequence implementation to manage the request and response lifecycle

**NOTE: Starting from 6.0.0, we have introduced a middleware-based sequence,
which is used as the default one for newly generated LoopBack applications using
`lb4` command from `@loopback/cli`.**

## Installation

To use this package, you'll need to install `@loopback/rest`.

```sh
npm i @loopback/rest
```

## Basic Use

Here's a basic "Hello World" application using `@loopback/rest`:

```ts
import {RestApplication, RestServer} from '@loopback/rest';

const app = new RestApplication();
app.handler(({request, response}, sequence) => {
  sequence.send(response, 'hello world');
});

(async function start() {
  await app.start();

  const server = await app.getServer(RestServer);
  const port = await server.get('rest.port');
  console.log(`Server is running at http://127.0.0.1:${port}`);
})();
```

## Configuration

See https://loopback.io/doc/en/lb4/Server.html#configuration.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT

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