-
Hi everyone! 😃 I would like to use express js with tauri app, but i can't figure out how to run express server and tauri app at the same time? 🤔 I tried to call express js in the main file where all the code for my application is but before that code..
import { appWindow } from "@tauri-apps/api/window";
import { invoke } from "@tauri-apps/api/tauri";
import express from "express";
const app = express();
const port = 3000;
app.listen(3000, () =>
console.log('App listening on port 3000!'),
);
// below is the rest of the code for tauri app... I'm using rollup.js module bundler and this is configuration that I use:
When bundling, rollup does not show any problem, but when I run the application |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 20 replies
-
ExpressJS is an NodeJS library, it won't work in Tauri's webview. If you need the functionality of a webserver, then either use the sidecar pattern or look for an equivalent rust crate of ExpressJS. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@phantomdenkali I don't find it necessary to package all dependancies. |
Beta Was this translation helpful? Give feedback.
-
I think the solution could be using NEXE and compiling the backend in another app, and using it like a real server, it would help also in the case you want multiple TAURI client to interact together. |
Beta Was this translation helpful? Give feedback.
-
@loprima-l Here's how I'm managing them in a single Tauri app Recording.2023-06-16.212234.mp4 |
Beta Was this translation helpful? Give feedback.
ExpressJS is an NodeJS library, it won't work in Tauri's webview.
If you need the functionality of a webserver, then either use the sidecar pattern or look for an equivalent rust crate of ExpressJS.