Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loopback/rest

Package Overview
Dependencies
Maintainers
7
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loopback/rest

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

  • 14.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25K
decreased by-0.83%
Maintainers
7
Weekly downloads
 
Created
Source

@loopback/rest

The REST API package for 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 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.

npm i @loopback/rest

Basic Use

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

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

Tests

Run npm test from the root folder.

Contributors

See all contributors.

License

MIT

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc