Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run an application in codesandbox with different subfolder for backend and frontend

I want to get a codesandbox for an app I am working on. How do I make the project work with two different subfolders named backend and frontend? How can that be done? I am sending for you my packages.json file content:

{
  "name": "projeto_aplicado",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "concurrently": "^6.2.0"
  },
  "devDependencies": {},
  "scripts": {
    "server": "npm run server --prefix backend",
    "start": "concurrently \"npm run server\" \"npm run client\" ",
    "client": "npm start --prefix frontend"
  },
  "author": "",
  "license": "ISC"
}

I am also sending the link for my web app: https://codesandbox.io/s/blissful-fire-jjnl5?file=/package.json:0-393

like image 461
lucasbbs Avatar asked Jan 23 '26 19:01

lucasbbs


1 Answers

You can't do that on codesandbox without Express as far as I know, here's a relevant Github issue: https://github.com/codesandbox/codesandbox-client/issues/1519.

This is for now not really possible unless you just display an HTML page from express :(

I took the express example starter template and edited it to work with 2 separate folders like your requirement, here's the link: https://codesandbox.io/s/cool-worker-wj464?file=/backend/app.js

I just created and renamed a folder and changed the code to use the right directories.

like image 123
Ethicist Avatar answered Jan 25 '26 10:01

Ethicist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!