我想用实验室测试hapi路由,我正在使用mysql数据库.
使用Server.inject测试路由的问题是我无法模拟数据库因为我没有调用包含处理函数的文件,所以如何在处理程序中注入模拟数据库?
我正在使用apollo-server和apollo-graphql-tools,我有以下架构
type TotalVehicleResponse {
totalCars: Int
totalTrucks: Int
}
type RootQuery {
getTotalVehicals(color: String): TotalVehicleResponse
}
schema {
query: RootQuery
}
Run Code Online (Sandbox Code Playgroud)
和解析器功能是这样的
{
RootQuery: {
getTotalVehicals: async (root, args, context) => {
// args = {color: 'something'}
return {};
},
TotalVehicleResponse: {
totalCars: async (root, args, conext) => {
// args is empty({}) here
.........
.........
},
totalTrucks: async (root, args, conext) => {
// args is empty({}) here
.........
.........
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何在任何子args解析器中访问root解析器(getTotalVehicals)中可用的?
我试图将Sequelize js与Serverless结合使用,它来自传统的服务器背景,我对在何处/如何运行数据库迁移感到困惑。
是否应该为运行迁移创建专用功能,或者是否还有其他运行迁移的方法?
migration sequelize.js serverless-framework sequelize-cli serverless-architecture
sequelize.js ×2
apollo ×1
graphql ×1
graphql-js ×1
hapijs ×1
migration ×1
node-mysql ×1
node.js ×1