小编Meh*_*ali的帖子

如何在reactjs应用程序中包含bootstrap css和js?

我是反应的新手,我想在我的反应应用程序中包含bootstrap

我已经安装了bootstrap npm install bootstrap --save

现在,想在我的反应应用程序中加载bootstrap css和js.

我正在使用webpack.

webpack.config.js

var config = {
    entry: './src/index',

    output: {
        path: './',
        filename: 'index.js'
    },

    devServer: {
        inline: true,
        port: 8080,
        historyApiFallback: true,
        contentBase:'./src'
    },

    module: {
        loaders: [
            {
                test: /\.js?$/,
                exclude: /node_modules/,
                loader: 'babel',

                query: {
                    presets: ['es2015', 'react']
                }
            }
        ]
    }
};

module.exports = config;
Run Code Online (Sandbox Code Playgroud)

我的问题是"如何在node_modules的reactjs app中包含bootstrap css和js?" 如何设置bootstrap以包含在我的反应应用程序中?

twitter-bootstrap reactjs webpack

113
推荐指数
10
解决办法
18万
查看次数

登录我的网站后使用谷歌登录获取谷歌帐户信息(使用的卫星库登录)

我已经使用卫星 和节点服务器登录我的网站,谷歌唱歌.

我已成功登录并在mongodb数据库中添加了以下数据.

{
    "_id" : ObjectId("57adec45a8fb51401c1ba843"),
    "displayName" : "xyz user",
    "picture" : "https://lh3.googleusercontent.com/-xxxxxxx_xx/xxxxxx/xxxxxxx/xxxxxxx/photo.jpg?sz=200",
    "google" : "100379763204xxxxxxxxx", //user id
    "__v" : 0
} 
Run Code Online (Sandbox Code Playgroud)

现在,我想从谷歌帐户获取其他信息,如性别,电话号码,位置等...

那么,如何从谷歌帐户获取登录用户的所有信息?

google-api mongodb node.js angularjs satellizer

5
推荐指数
1
解决办法
429
查看次数

如何配置 Angular 通用(Angular 6)+ Socket.io + Node API 服务器项目(带有 Angular 通用和 Socket.io 的 MEAN 堆栈)?

我是 Angular 通用和 Socket.io 的新手。

我想使用Angular-universal(Angular-6)为服务器端渲染Socket.io和NodeAPI server(express)项目创建一个MEAN堆栈项目。

我使用angular-cli6 来生成 Angular-6 项目。

所以,我的问题是如何配置 Angular-universal(Angular 6) + Socket.io + Node API 服务器项目(带有 Angular 通用和 Socket.io 的 MEAN 堆栈)。

任何文章或博客都会非常有帮助。

提前致谢。

node.js express socket.io angular-universal angular6

5
推荐指数
0
解决办法
555
查看次数

从对象数组中计算特定键值

我有以下JSON数组我想创建对象表单状态键计数

[
  {
    "id": "65:0",    
    "status": "ORANGE"
  },
  {
    "id": "65:0",
    "status": "GREEN"
  },
  {
    "id": "65:0",
    "status": "ORANGE"
  },
  {
    "id": "65:0",
    "status": "YELLOW"
  },
  {
    "id": "65:0",
    "status": "RED"
  },
  {
    "id": "65:0",
    "status": "GREEN"
  },
  {
    "id": "65:0",
    "status": "GREEN"
  },
   {
    "id": "65:0",
    "status": "ORANGE"
  },
  {
    "id": "65:0",
    "status": "YELLOW"
  },
  {
    "id": "65:0",
    "status": "GREEN"
  }
] 
Run Code Online (Sandbox Code Playgroud)

想要计算状态键值并创建以下对象

{
 'ORANGE' : 3,
 'GREEN' : 4,
 'YELLOW' : 2,
 'RED' : 1,
}
Run Code Online (Sandbox Code Playgroud)

javascript arrays json object angularjs

2
推荐指数
1
解决办法
4263
查看次数

如何从节点服务器发送http post调用?

我试图https://api-mean.herokuapp.com/api/contacts用以下数据发送邮件调用:

{
    "name": "Test",
    "email": "test@xxxx.in",
    "phone": "989898xxxx"
}
Run Code Online (Sandbox Code Playgroud)

但没有得到任何回应.我也尝试过邮差它工作正常.我在邮递员中得到回复.

我使用以下nodejs代码:

        var postData = querystring.stringify({
            "name": "Test",
            "email": "test@xxxx.in",
            "phone": "989898xxxx"
        });

        var options = {
            hostname: 'https://api-mean.herokuapp.com',
            path: '/api/contacts',
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            }
        };

        var req = http.request(options, function (res) {
            var output = '';
            res.on('data', function (chunk) {
                output += chunk;
            });

            res.on('end', function () {
                var obj = JSON.parse(output.trim());
                console.log('working = ', obj);
                resolve(obj);
            });
        });

        req.on('error', function (e) {
            console.error(e);
        }); …
Run Code Online (Sandbox Code Playgroud)

post node.js

2
推荐指数
1
解决办法
1万
查看次数

如何创建“喜欢计数”Cloud Firestore聚合函数?

我是 firebase 的新手,我想为喜欢计数创建一个聚合函数。

我有三个根集合:提要、喜欢和用户。

feeds 具有以下字段:

在此输入图像描述

description: <description of feed>

likeCount:<Total count of like>

title: <feed title>

userId: <userId of feed>


Likes 有以下字段:

在此输入图像描述

feedId: <id of the feed where a user gives like>

likeBy: <id of the user who likes the feed>

likeTo: <id of the user how created a feed>


用户有以下字段:

username: <User name>

email: <User email>

当用户喜欢某个提要时,就会在喜欢集合中添加新条目。

我正在尝试创建一个聚合函数,以便increase likeCount in feed collection用户在提要上给出喜欢的信息。


我正在检查解决方案。我找到了嵌套结构的解决方案,如下所示

在此输入图像描述


所以,我的问题是,是否可以使用我的数据结构(三个根集合:提要、喜欢和用户)为喜欢计数创建一个聚合函数?如果是的话我怎样才能实现它?

或者我需要更改我的数据结构吗?

aggregate-functions firebase google-cloud-functions google-cloud-firestore

2
推荐指数
1
解决办法
1787
查看次数