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

rumbo

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rumbo

Build fullstack apps, powered by ExpressJS/React

  • 0.6.62
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by166.67%
Maintainers
1
Weekly downloads
 
Created
Source

Rumbo

Rumbo allows you to build fullstack app with Express and React in NodeJS, inspired by NextJS.

This library will automatically resolve paths for your apps, so you don't have to register paths with Express on the server, or with React Router for the client.

Have a look at Rumbo Typescript Template for an example to use Rambo with Typescript

Supported:

  • Basic methods: GET, POST, PATH, OPTIONS, DELETE
  • Middleware using _middleware
  • Nested routes

Example folder structure

src
├── apps
│   ├── api
│   │   ├── _middleware.ts
│   │   ├── index.ts // or get.ts
│   │   │── post.ts
│   │   │── users
│   │       ├── index.ts
│   ├── client
│   │   ├── _layout.ts
│   │   ├── index.ts
│   │   │── users
│   │       ├── index.ts
├── dev.ts
├── index.ts
├── rumboConfigs.ts

Rumbo configs

import path from "path";
import { RumboProps } from "rumbo";

const rumboConfigs: RumboProps = {
  debug: true,
  rootDir: __dirname,
  listen: {
    port: parseInt(process.env.PORT || "3000"),
    host: process.env.HOST || "localhost"
  },
  routes: {
    "/": {
      type: "client-ssr",
      location: path.join(__dirname, "routes/client"),
    },
    "/api": {
      type: "server",
      location: path.join(__dirname, "routes/api"),
      excludePaths: ["includes"]
    },
  },
  // must specify for generating files in runtime
  staticRoutes: null
};

export default rumboConfigs;

Register middleware

// src/app/api/_middleware.ts
import { Request, Response, NextFunction } from "express";

export default function(req: Request, res: Response, next: NextFunction) {
  console.log("/admin/_middleware");
  next()
}

Register GET

// src/app/server/index.ts
import { Request, Response } from "express";

export default function(req: Request, res: Response) {

  res.json({
    message: "ok"
  })
}

Register nested route

// src/app/server/users/index.ts
import { Request, Response } from "express";

export default function(req: Request, res: Response) {
  res.json({
    message: "ok"
  })
}

Register routes

// app.ts
import express from "express";
import rumbo from "rumbo";

import configs from "./rumboConfigs";

const app = express();
rumbo(app, configs);

Keywords

FAQs

Package last updated on 11 May 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