-1

I have a Web Application with multiple pages (Login, Signup, forget password etc ) created using TypeScript . I want to create config file such a way that , when users click on Submit button on Login page it should take them to home page or if they click on Forget password it should take them to the forget password page. How can i achieve this scenario in nginx.

I researched but couldn't find relevant documentation or Blogs on the same.

Attaching my Sample nginx.conf for your reference . This Conf file only have location configurations for all those pages .

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  _;
        root   html/webconsole/WebConsole/src;

        location / {
            index  index.html index.htm;
        }
        location /register {
            alias  html/webconsole/WebConsole/src/app/register/;
            index register.component.html register.component.htm;
        }
        location /register-confirm {
            alias  html/webconsole/WebConsole/src/app/register-confirm/;
            index register-confirm.component.html register-confirm.component.htm;
        }
        location /login {
            alias  html/webconsole/WebConsole/src/app/login/;
            index login.component.html login.component.htm;
        }
        location /forget-pwd {
            alias  html/webconsole/WebConsole/src/app/forget-pwd/;
            index forget-pwd.component.html forget-pwd.component.htm;
        }
        location /resend {
            alias  html/webconsole/WebConsole/src/app/resend/;
            index resend.component.html resend.component.htm;
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

Let me know how can i achieve my requirement .

Thanks in Advance

Ivan Shatsky
  • 13,267
  • 2
  • 21
  • 37
Nishar sheik
  • 151
  • 1
  • 4
  • 20
  • I don't understand how nginx is related to your problem. All these redirects should be done in your Web App source code. You can either use a simple hyperlink and style it as button or you can do it directly with JavaScript (or TypeScript) - see [How do I redirect to another webpage?](https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage) – Ivan Shatsky Jun 22 '21 at 12:49
  • Hi @IvanShatsky Thank you for your response . I already Have TS files which will fulfull this requirement but how do i define in nginx that it should read the respective ts files ? – Nishar sheik Jun 22 '21 at 13:03

1 Answers1

0

I Actually found answer ! As i am using Angular application . I need to install node.js & npm & need to run ng build to get the bundle of my code & using that bundle I can serve the nginx

Steps followed :

  1. Installing Nodejs& npm
  2. Performing npm install for node packages
  3. Installing angular cli & running ng build command in my source directory
Nishar sheik
  • 151
  • 1
  • 4
  • 20