我正在使用 create-react-app 开发 ReactJS 应用程序。
npm start 和 npm run 构建应用程序工作正常,应用程序在端口号(如 4000 或 Pushstate-server 构建在端口 9000 中运行)运行,问题是我需要在公共 url 中运行没有端口号的构建应用程序像http://sample/home/,当我直接浏览 build/index.html 时,它正确显示主页,但路由不像端口中那样工作,所有 css 和资产都显示未找到。
我有一个带有某些字段的用户模型,并且引用了“技能”模型。
这些模型如下所示
1.Users.js(用户模型)
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const UsersSchema = new Scheam({
name: { type : String },
email: { type : String },
address: { type : String },
Skills: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Skills' }],
})
module.exports = mongoose.model('Users', UsersSchema);
Run Code Online (Sandbox Code Playgroud)
2.技能模型
const mongoose = require('mongoose')
const Schema = mongoose.Schema;
const SkillsSchema = new Schema({
name : { type: String },
});
module.exports = mongoose.model('Skills', SkillsSchema);
Run Code Online (Sandbox Code Playgroud)
我正在使用技能选择下拉菜单创建新用户,该下拉菜单存储用户模型中技能的ID。
通过在node js应用程序中填充Users模型来获取技能。
export function getUser(req, res) {
console.log('getUser'); …Run Code Online (Sandbox Code Playgroud) bundle ×1
graphql ×1
mern ×1
mongodb ×1
node.js ×1
npm ×1
react-native ×1
react-router ×1
reactjs ×1