我很抱歉我的新手问题,但是我正在度过这个错误的可怕日子,我有一个Express应用程序,我试图在docker compose中运行它.我用过这个Dockerfile:
FROM mhart/alpine-node
RUN mkdir -p /usr/src/app
RUN chmod -R 777 /usr/src/app
WORKDIR /usr/src/app
RUN npm install node-gyp -g
RUN npm install nodemon -g
ENV NODE_ENV development
EXPOSE 3000
Run Code Online (Sandbox Code Playgroud)
这部分我的docker-compose文件:
backend:
mem_limit: 100m
build:
context: .
dockerfile: dockerfiles/node/Dockerfile
command: npm start
depends_on:
- mongo
- elasticsearch
volumes:
- ./backend/:/usr/src/app
ports:
- 3000:3000
links:
- "mongo:mongo"
- "elasticsearch:elasticsearch"
Run Code Online (Sandbox Code Playgroud)
当我做docker-compose时,我收到这个错误:
backend_1 | npm info it worked if it ends with ok
backend_1 | npm info using npm@3.10.10
backend_1 | npm info …Run Code Online (Sandbox Code Playgroud) 我在服务器端使用Spring Boot,在客户端使用Angularjs,我使用Filter配置Spring Boot应用程序CORS,它适用于GET,POST方法,但是,当我尝试使用$ http模块发送PUT请求时,我得到了这个在我的浏览器控制台:
注意:url = http:// localhost:8080/localbusinessusers/[object%20Object]
选项url (匿名函数)@ angular.js:11442sendReq @ angular.js:11235serverRequest @ angular.js:10945processQueue @ angular.js:15552(匿名函数)@ angular.js:15568Scope.$ eval @ angular.js:16820Scope. $ digest @ angular.js:16636Scope.$ apply @ angular.js:16928done @ angular.js:11266completeRequest @ angular.js:11464requestLoaded @ angular.js:11405 app.html:1 XMLHttpRequest无法加载 网址.预检的响应具有无效的HTTP状态代码405 angular.js:11442 XHR加载失败:PUT" url ".
我在Spring Boot控制台上得到了这个:
2016-03-08 23:19:51.212 WARN 27044 --- [XNIO-2 task-2] osweb.servlet.PageNotFound:不支持请求方法'OPTIONS'
我的CORS 过滤器:
package com.datcom.fouras;
import …Run Code Online (Sandbox Code Playgroud) 我是VueJS的新手,我正在使用VueJS 2 Webpack模板.如果登录成功,我试图从登录组件重定向到主组件,我尝试了很多东西,但我仍然遇到错误.这是我的路线:
const router = new VueRouter({
mode: 'history',
routes: [{
'name': 'home',
path: '/',
component: require('./components/Home.vue'),
beforeEnter: (to, from, next) => {
if (!localStorage.getItem('user')) {
next('/login')
}
}
}, {
'name': 'profile',
path: '/profile',
component: require('./components/Profile.vue'),
beforeEnter: (to, from, next) => {
if (!localStorage.getItem('user')) {
next('/login')
}
}
}, {
'name': 'login',
path: '/login',
component: require('./components/Login.vue')
}, {
'name': 'new',
path: '/new',
component: require('./components/New.vue'),
beforeEnter: (to, from, next) => {
if (!localStorage.getItem('user')) {
next('/login')
}
}
}, { …Run Code Online (Sandbox Code Playgroud) 我需要知道修改的字段,或者一个特定领域是在修改前或后 更新挂钩的猫鼬架构。我尝试了以下操作,但仍然无法弄清楚:
schema.post('update', function (doc) {
//check modified fields or if the name field was modified and then update doc
});
Run Code Online (Sandbox Code Playgroud)
我知道也许有一个方法isModified就像在预 保存中一样,但是我不知道如何使用更新挂钩。任何建议将不胜感激。
我有一个Spring Boot应用程序,我想在其中使用独立的Elastic search 2.2.0(不是嵌入式服务器),我想使用Spring Data Elastic search,那么Spring Data支持的Elastic search版本是什么以及如何配置它连接到在localhost:9200中运行的elasticsearch实例吗?
实际上,我尝试将以下选项添加到我的application.properties文件中:
spring.data.elasticsearch.repositories.enabled=true
spring.data.elasticsearch.cluster-nodes=localhost:9200
Run Code Online (Sandbox Code Playgroud)
然后,我创建了这个配置类:
@Configuration
public class ElasticConfig {
@Bean
public ElasticsearchOperations elasticsearchTemplate() {
return new ElasticsearchTemplate(client());
}
@Bean
public Client client() {
TransportClient client = new TransportClient();
TransportAddress address = new InetSocketTransportAddress(
"localhost",9200);
client.addTransportAddress(address);
return client;
}
}
Run Code Online (Sandbox Code Playgroud)
我得到这个堆栈跟踪:
2016-04-28 00:03:52.246 INFO 25613 --- [restartedMain] org.elasticsearch.plugins:[Aardwolf]已加载[],网站[] 2016-04-28 00:04:01.356 INFO 25613 --- [ restartedMain] org.elasticsearch.client.transport:[Aardwolf]无法获取[#transport#-1] [fathi-HP-Pavilion-g6-Notebook-PC] [inet [localhost / 127.0.0.1:9200]]的节点信息],正在断开连接...
org.elasticsearch.transport.ReceiveTimeoutTransportException:[] [inet [localhost / 127.0.0.1:9200]] [cluster:monitor / nodes / info] request_id …
java spring elasticsearch spring-boot spring-data-elasticsearch
我很抱歉我的新手问题,我正在尝试使用@Output EventEmitter. 我无法在我的父组件中捕获事件。
子组件
@Component({
selector: 'app-new-attachment',
templateUrl: './new-attachment.component.html',
styleUrls: ['./new-attachment.component.css']
})
class NewAttachmentComponent {
@Input('attachment') attachment: any;
@Output() doneEditingAttachment:EventEmitter<boolean> = new EventEmitter<boolean>();
submit() {
console.log('done editing child');
this.doneEditingAttachment.emit(true);
}
}
Run Code Online (Sandbox Code Playgroud)
父组件
@Component({
selector: 'app-new-article',
templateUrl: './new-article.component.html',
styleUrls: ['./new-article.component.css']
})
class NewArticleComponent {
newAttachment: any = {};
doneEditingAttachment($event) {
console.log('done editing parent ', $event);
}
}
Run Code Online (Sandbox Code Playgroud)
我希望有
完成编辑孩子
而一个
完成编辑父项
但我只完成了编辑孩子
javascript ×4
node.js ×2
spring ×2
spring-boot ×2
angular ×1
angularjs ×1
cors ×1
docker ×1
java ×1
mongodb ×1
mongoose ×1
npm ×1
typescript ×1
vue-router ×1
vue.js ×1
vuejs2 ×1