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

bridge

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bridge

Bridge is a Typescript Node.js framework that provides an easy and scalable way to create REST APIs while generating the client code.

  • 2.0.71
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Bridge

Bridge is the most straightforward yet powerful framework for creating simple or complex APIs using the full power of TypeScript, even for developers with little experience. Give it a try and see how easy it is to build your dream API!

Documentation

Full documentation for bridge can be found here.

Installation

# npm
npm install bridge
# Yarn
yarn add bridge
# pnpm
pnpm add bridge

Quickstart

# npm
npx create-bridge-app@latest
# Yarn
yarn create bridge-app
# pnpm
pnpm create bridge-app

Basic Example

import { initBridge, handler } from 'bridge';
import express from 'express';
// You can also use Yup or Superstruct for data validation
import z from 'zod';

const port = 8080;

// A handler can be used as an endpoint but also as a middleware
const heyHandler = handler({
  query: z.object({ name: z.string() }),
  resolve: ({ query }) => `Hey ${query.name}`,
});

// You can also have multiple endpoints for the same route with different methods with the method function
const routes = {
  hey: heyHandler, // POST /hey
};

// It is also possible to use pure HTTP Server
const app = express();

app.use('', initBridge({ routes }).expressMiddleware());

app.listen(port, () => {
  console.log(`Listening on port ${port}`);
});

For more complex examples and a full understanding of the capabilities of Bridge, be sure to check out our documentation!

Client code generation and documentation

Connect your Bridge API to Bridge Studio

With the CLI

npx bridge-studio@latest
# or
pnpx bridge-studio@latest

With the plateform: https://studio.bridge.codes

Fetch your client SDK

npx fetch-bridge-sdk@latest {username}/{projectName}

Access your generated documentation

You'll be able to access your complete generated documentation on https://studio.bridge.codes soon.

Please visit https://bridge.codes/studio for more information.

Keywords

FAQs

Package last updated on 04 Jan 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