简体   繁体   English

NodeJS:如何从路由重定向到其他域名

[英]NodeJS : How to redirect to a different domain name from a route

I am building a MEAN Stack application and my API runs on app.example.com and my frontend runs on web.example.com . 我正在构建MEAN Stack应用程序,并且我的API在app.example.com运行,而前端在web.example.comweb.example.com
I am trying to build an email verification system, which will send an email to the user. 我正在尝试建立一个电子邮件验证系统,该系统将向用户发送电子邮件。 The link I send is app.example.com/email-verification/${URL} which is one of my routes in my application. 我发送的链接是app.example.com/email-verification/${URL} ,这是我在应用程序中的路线之一。 After verifying the user I want him to go (in frontend) from web.example.com/login (Mind you this is angular's routing) to web.example.com/dashboard . 验证用户之后,我希望他(从前端)从web.example.com/login (请注意,这是web.example.com/dashboard的路由)转到web.example.com/dashboard How do I achieve this? 我该如何实现? Is this actually possible? 这实际上可行吗?

I hope I understand the question, but I think it's pretty simple: 我希望我理解了这个问题,但是我认为这很简单:

$location.path('/dashboard');

User fills the form (Angular-front) -> User clicks the email (In the url you can put a param with the email encripted) -> The controller check the param and call to the NODE API method that verify email -> When angular front get a successful response from api : Login method and $location.path('/dashboard'); 用户填写表单(Angular-front)->用户单击电子邮件(在url中,您可以将带有已写电子邮件的电子邮件放入参数中)->控制器检查该参数并调用NODE API方法以验证电子邮件->当成角度时front从api获得成功的响应:登录方法和$ location.path('/ dashboard');

Sorry my english :P 对不起,我的英语:P

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM