简体   繁体   中英

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

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.

first you show your Html page of this project and ha the app.js also to understand how to connect it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM