我使用的是Visual Studio Code 0.7.10版.我想使用版本控制.我认为这是开始自学使用git的好时机.我以前从未使用过它.
如何让git忽略我的"node_modules"文件夹?此文件夹中的每个项目都列出了可能的提交,这使我的工作区变得混乱.我不想上传所有的包.我认为运行package.json的人可以在他们自己的计算机上执行此操作.
想法:我在文件>首选项>用户设置下找到了一个名为"settings.json"的配置文件,它将覆盖默认设置.我在默认设置中看到"Git配置",但我找不到有关我可能选项的任何文档.我想我可以做一个"git.exclude",但我从哪里开始.这只是对解决方案的猜测.我确信真正的答案是完全不同的.
我正在寻找你可以指出的任何文件.谢谢!
更新:我对".git/info/exclude"文件进行了更改,我的Git存储库视图立即被清除.这是一个链接,讨论排除文件及其为我的VS代码编辑器工作的原因.(https://help.github.com/articles/ignoring-files/)
我正在使用ng-repeat来显示我的数据.这工作正常.
我的ng-repeat结果集中的一个数据字段是一个项目数组.
Example: {x:1, y:[2,3,4]}
我想按数组中的数据过滤数据.我可以很容易地通过非数组数据进行过滤,但是当我尝试通过在数组中查找inisde来进行文件管理时遇到了麻烦.
这是我的标记
ng-repeat = "con in cons | filter: usrSingle.username in con.conPlayerList"
(编辑标记以更好地匹配我的示例ng-repeat = "con in cons | filter: '3' in con.y"
)
usrSingle是我可以访问的控制器中的范围.我没有得到任何错误,我似乎无法找到这方面的例子.
请求了更多代码,现在在下面.我忘了提到这是一个MEAN应用程序.我有MongoDB提供数据.我使用REST API进行数据调用.
来自角度模块的(EDIT)代码:
// call to the api for data
app.factory('usrService', function ($resource) {
return $resource('/api/users', {});
});
// factory to hold user data between controllers
app.factory('usrTracker', function () {
var vUsrProfile = {
usrSingle: 'usrSingle'
};
return {
getProperty: function () {
return vUsrProfile;
},
setProperty: function (value) { …
Run Code Online (Sandbox Code Playgroud) 我在处理 Node.js http 请求时遇到问题。(如果我无法弄清楚,我稍后会问一个更大的问题)。
我有修改过的代码和示例,但我不明白 response.on 的含义。在阅读 Node.js 中有关 http 的更多信息(HTTP 事务剖析)时,我没有看到人们使用带有“response.on”的示例。我想我知道,但我想澄清一下。哦,我也在使用 Express.js。
谢谢
下面是我用来尝试调用我需要响应的 BART api 的代码。
...
// Real Time Departure from a given station
router.route('/departTimeStation')
.get(function(req, res) {
vCmd = 'etd';
vOrig = req.query.vOriginStation;
vDir = 'n'; // [NOTE] - 'n' or 's', north or south, OPTIONAL
vPlat = 1; // [NOTE] - 1 to 4, number of platform, OPTIONAL
var xoptions = {
host: 'api.bart.gov',
path: '/api/etd.aspx?cmd=' + vCmd + '&orig=' + vOrig + …
Run Code Online (Sandbox Code Playgroud) 使用passport-google-oauth: "0.2.0"
在我MEAN堆栈的应用程序(这里找到:https://github.com/jaredhanson/passport-google-oauth).当我运行该应用程序并尝试使用Google API登录时,会返回此错误
- 那是一个错误.
错误:invalid_request
缺少必需参数:redirect_uri
请求详细信息scope = https://www.googleapis.com/auth/plus.login response_type = code redirect_uri = client_id = xxxx-xxxx.apps.googleusercontent.com
重定向参数在这里
passport-init.js
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var GOOGLE_CLIENT_ID ="xxx-xxx.apps.googleusercontent.com"; var GOOGLE_CLIENT_SECRET ="xxxx";
passport.use(新的GoogleStrategy({
clientID:GOOGLE_CLIENT_ID,
clientSecret:GOOGLE_CLIENT_SECRET,
callbackUrl:" http://127.0.0.1:3000/auth/google/oauth2callback "},function(accessToken,refreshToken,profile,done){done( null,profile);}));
路线在这里 authenticate.js
router.get('/ google',passport.authenticate('google',{scope:[' https://www.googleapis.com/auth/plus.login ']}),function(req,res){} );
router.get('/ google/oauth2callback',passport.authenticate('google',{successRedirect:'/ auth/success',failureRedirect:'/ auth/failure'}),function(req,res){res.redirect ('/');});
我确信我遗漏了一些简单的东西,但我不知道在这个问题中添加什么会给你最好的信息.请问,我会尽力回答你.这就像是相关数据.
有趣的是,如果我手动添加callbackUrl,那么一切都很好.我可以很好地使用Google API.然后我可以选择"允许"或"拒绝"请求.