Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support integrating Toolpad in a custom server #2470

Closed
5 of 11 tasks
Janpot opened this issue Aug 10, 2023 · 1 comment
Closed
5 of 11 tasks

Support integrating Toolpad in a custom server #2470

Janpot opened this issue Aug 10, 2023 · 1 comment
Assignees
Labels
new feature New feature or request

Comments

@Janpot
Copy link
Member

Janpot commented Aug 10, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Currently Toolpad requires starting up its own server process with toolpad start. Instead I'd like to be able to integrate a Toolpad application into my own server. I wish Toolpad would be able to generate a module that I could directly import in my express(-like) server and call in any connect middleware compatible webserver.

Examples 🌈

After running

toolpad build

I can import a generated module from e.g. ./toolpad/.generated/server which I can use as follows:

// ./server.js
import express from 'express';
import path from 'path;
import { createHandler } from '@mui/toolpad';

const toolpadHandler = createHandler({
  dir: path.resolve(process.cwd(), './myApp'),
  basePath: '/toolpad' 
})

const app = express()

app.use('/foo', (req, res) => {
  // ... my own application logic
})

app.use('/toolpad', toolpadHandler)

const server = app.listen(3000)

Now I can run my application

node ./server.js

and Can access the toolpad application on http://localhost:3000/toolpad

Motivation 🔦

This could lower the barrier for teams that don't maintain their own infrastructure as it should allow them to integrate Toolpad without infrastructure changes.

Steps

@Janpot Janpot added new feature New feature or request waiting for 👍 Waiting for upvotes labels Aug 10, 2023
@prakhargupta1 prakhargupta1 changed the title Support integrating Toolpads in a custom server Support integrating Toolpad in a custom server Aug 10, 2023
@Janpot Janpot self-assigned this Sep 28, 2023
@prakhargupta1 prakhargupta1 removed the waiting for 👍 Waiting for upvotes label Oct 17, 2023
@prakhargupta1
Copy link
Member

I am marking it as Done. @Janpot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: Completed
Development

No branches or pull requests

2 participants