简体   繁体   English

如何在后端和前端具有不同子文件夹的代码沙箱中运行应用程序

[英]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?如何使项目与名为 backend 和 frontend 的两个不同子文件夹一起工作? How can that be done?怎么可能呢? I am sending for you my packages.json file content:我正在为您发送我的packages.json文件内容:

{
  "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我还发送了我的 web 应用程序的链接: https://codesandbox.io/s/blissful-fire-jjnl5?file=/package.Z466DEEC76ECDF5FCA6D38571F63324D38571F63324D

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 .据我所知,你不能在没有 Express 的 codesandbox 上执行此操作,这是一个相关的 Github 问题: https://github.com/codesandbox/codesandbox-client/issues/1519

This is for now not really possible unless you just display an HTML page from express:(除非您只显示来自 express 的 HTML 页面,否则目前这实际上是不可能的:(

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我采用了快速示例入门模板并对其进行了编辑以使用 2 个单独的文件夹,如您的要求,这是链接: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.首先你展示你这个项目的 Html 页面,并且还有 app.js 来了解如何连接它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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