我正在尝试在天蓝色上配置静态应用程序,但很难正确路由。当我导航到/lti/login/
应用程序内时,它工作正常。但如果我刷新它会抛出 404,这告诉我我的routes.json
设置不正确(也许)。我希望有人能对此有所启发。
routes.json
{
"routes": [
{
"route": "/",
"serve":"/"
},
{
"route": "/lti/login/*",
"serve":"/lti/login"
}
]
}
Run Code Online (Sandbox Code Playgroud)
App.js
<Router>
<div>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/lti/login/">About</Link>
</li>
</ul>
<hr />
{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route exact path="/">
<Form />
</Route>
<Route path="/lti/login/*"> <----- If I navigate to this within the app and then refresh it throws a …
Run Code Online (Sandbox Code Playgroud) 所以,我刚刚处理了这个问题。但我需要弄清楚我不断得到的
EADDRINUSE :::5000
server.js 片段
const port = process.env.PORT || 5000;
var server = app.listen(port, () =>
console.log(`Server running on port ${port}`)
);
Run Code Online (Sandbox Code Playgroud)
如果我运行命令,sudo lsof -i tcp:5000
我会得到以下信息:
node 16476 jedi 59u IPv4 0x5494461608a39abb 0t0 TCP localhost:62154->localhost:commplex-main (ESTABLISHED)
node 16499 jedi 12u IPv6 0x54944615f7c1134b 0t0 TCP *:commplex-main (LISTEN)
node 16499 jedi 15u IPv6 0x54944615f724ee0b 0t0 TCP localhost:commplex-main->localhost:62154 (ESTABLISHED)
Run Code Online (Sandbox Code Playgroud)
我每次都通过终止节点进程来解决这个问题,但这很烦人。我怎样才能找出导致这种冲突的原因?我正在同时运行我的 Node 服务器和 React 环境。我注意到,当我独立运行节点时,我没有收到错误。我的代理设置package.json
"proxy": "http://localhost:5000"
Run Code Online (Sandbox Code Playgroud)
我更改了端口,但仍然出现错误。有什么建议么?
我的students
文档中有一系列,VirtualClass
我的目标是创建一个没有重复学生的名册。
我想将VirtualClass
与老师和$push
学生匹配到一个数组中。
虚拟类模式
const VirtualClassSchema = new Schema({
name: { type: String, required: true },
descriptionHeading: { type: String, required: true },
room: { type: String },
teacher: {
userId: { type: Schema.Types.ObjectId, ref: "User" },
name: { type: String },
profile_picture: { type: String }
},
students: [
{
userId: { type: Schema.Types.ObjectId, ref: "User" },
name: { type: String },
profile_picture: { type: String }
}
],
...
Run Code Online (Sandbox Code Playgroud)
我目前的查询如下
VirtualClass.aggregate([ …
Run Code Online (Sandbox Code Playgroud) 我正在克隆一个存储库并在运行时收到以下错误npm install
ENOENT:没有这样的文件或目录,重命名 '/Users/waston/Desktop/hm/STEMuli_MaterialUI/node_modules/.staging/client-6b05b6f7/node_modules/@babel/helper-module-imports' -> '/Users/waston/Desktop /hm/STEMuli_MaterialUI/node_modules/.staging/@babel/helper-module-imports-b86e8d76'
我想如果我npm install --save-dev @babel/helper-module-imports
这样做可能会解决它,但即使这样做也会给我带来同样的错误。
package.json(服务器)
"dependencies": {
"azure-storage": "^2.10.2",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.2",
"cd": "^0.3.3",
"client": "file:client",
"concurrently": "^3.5.1",
"express": "^4.16.3",
"gravatar": "^1.6.0",
"install": "^0.12.2",
"into-stream": "^4.0.0",
"jsonwebtoken": "^8.2.0",
"mongoose": "^5.0.12",
"multer": "^1.4.1",
"multer-azure-storage": "^0.2.0",
"node-sass": "^4.10.0",
"npm": "^6.4.1",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"validator": "^9.4.1"
},
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm …
Run Code Online (Sandbox Code Playgroud) 我不确定如何将颜色从默认的蓝色更改为其他颜色。示例代码在下面的codeandbox链接中。我尝试更改root的样式,但没有成功。
我正在使用JSFiddle的这个片段 而且我无法将箭头从左侧移动到右侧.
我尝试修改bubble:before
,我让箭头切换到右边.但我现在遇到的问题反映了它!谢谢
我有一个像这样的数组.
const array =["king", "henry", "died", "while", "drinking", "chocolate", "milk"]
Run Code Online (Sandbox Code Playgroud)
我有以下初始状态
state = {
options:{}
}
Run Code Online (Sandbox Code Playgroud)
如果我想将此数组映射到我的状态并将每个索引字符串分配为我将this.state.options
如何执行此操作的属性?
所以最终的结果是:
console.log(this.state.options)
Run Code Online (Sandbox Code Playgroud)
输出:{king:null,henry:null,death:null,while:null,drinking:null,chocolate:null,milk:null}
我认为在那之后它将是未定义的而不是null ...但是有什么建议吗?
reactjs ×4
javascript ×2
node.js ×2
arrays ×1
azure-static-website-routing ×1
babeljs ×1
css ×1
git ×1
html ×1
mongodb ×1
node-modules ×1
react-select ×1
right-align ×1