小编Ven*_*omu的帖子

在没有端口的情况下启动 ReactJS 应用程序

我正在使用 create-react-app 开发 ReactJS 应用程序。

npm start 和 npm run 构建应用程序工作正常,应用程序在端口号(如 4000 或 Pushstate-server 构建在端口 9000 中运行)运行,问题是我需要在公共 url 中运行没有端口号的构建应用程序像http://sample/home/,当我直接浏览 build/index.html 时,它正确显示主页,但路由不像端口中那样工作,所有 css 和资产都显示未找到。

bundle npm reactjs react-router react-native

6
推荐指数
1
解决办法
5165
查看次数

如何在没有_id参考的情况下在GraphqQL列表中获取模型的填充值?

我有一个带有某些字段的用户模型,并且引用了“技能”模型。

这些模型如下所示

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)

mongodb node.js graphql mern express-graphql

6
推荐指数
0
解决办法
67
查看次数