Giter Site home page Giter Site logo

bridge-codes / bridge Goto Github PK

View Code? Open in Web Editor NEW
318.0 2.0 4.0 9.56 MB

Bridge is a Typescript Node.js framework that provides an easy and scalable way to create REST APIs while generating the client code. Our goal is to make Bridge a great framework for both frontend and backend teams, so if you're familiar with Node.js and Typescript, you'll feel right at home.

Home Page: https://bridge.codes

License: MIT License

JavaScript 10.26% TypeScript 79.21% CSS 6.64% MDX 3.90%
api express typesafe expressjs nodejs rest-api

bridge's Introduction

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.

bridge's People

Contributors

angelhdzmultimedia avatar digitalu avatar erjanmx avatar esau-morais avatar raulmihaila avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bridge's Issues

Dynamic Routes

Hey, is there a way to do dynamic routes like in express? e.g:

/users/:userid
/users/:userid/posts/:postid

Thanks!

Dev run on fresh install under windows fails

Issue: yarn dev fails in project dir after fresh install under Windows machine.
Caused by: missing adm-zip package
Solution: install adm-zip manually to project dir.

Probably adm-zip devdep missing in bridge package since there is only typings required in corresponding package.json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.