I'm using ember-simple-auth in my emberjs app to authenticate via oauth2-password-grant with my own (currently unimplemented) service.
我在我的emberjs应用程序中使用ember-simple-auth通过oauth2-password-grant使用我自己的(当前未实现的)服务进行身份验证。
I'd like to continue developing the front-end before creating the authentication service.
我想在创建身份验证服务之前继续开发前端。
Can the authentication service be stubbed so login/logout features can be used? I'm aware that I mock it with http-mock during tests, but I would also like to work on the front-end design and view it in the browser.
身份验证服务是否可以存根,因此可以使用登录/注销功能?我知道我在测试期间用http-mock模拟它,但我也想在前端设计上工作并在浏览器中查看它。
1 个解决方案
#1
1
HTTP mocks also run during development. You can also use Pretender or Mirage (a library built on top of Pretender) to clientside mocks.
HTTP模拟也在开发期间运行。您还可以使用Pretender或Mirage(在Pretender之上构建的库)来实现客户端模拟。
In Mirage your route may look something like this:
在Mirage中,您的路线可能如下所示:
// app/mirage/config.js
this.post('/users/sign_in', (db, request) => {
return {
user_email: "some.user@gmail.com",
user_id: 1,
user_token: "LcsBEYP2yjTcc-G7drto"
};
});
depending on the shape of your backend response.
取决于后端响应的形状。
#1
1
HTTP mocks also run during development. You can also use Pretender or Mirage (a library built on top of Pretender) to clientside mocks.
HTTP模拟也在开发期间运行。您还可以使用Pretender或Mirage(在Pretender之上构建的库)来实现客户端模拟。
In Mirage your route may look something like this:
在Mirage中,您的路线可能如下所示:
// app/mirage/config.js
this.post('/users/sign_in', (db, request) => {
return {
user_email: "some.user@gmail.com",
user_id: 1,
user_token: "LcsBEYP2yjTcc-G7drto"
};
});
depending on the shape of your backend response.
取决于后端响应的形状。