1

I'm using node js as server. Do i have to configure index.js file while using localtunnel? While submitting form, which URL do I have to specify? should i use URL provided by localtunnel.

<form name="formname" action="http://localhost:3000/register" method="post">

I know its a silly question. Can somebody provide a small guidance?

Black Heart
  • 649
  • 1
  • 7
  • 19

2 Answers2

1

Assuming your routes are set up, you should just be able to post to /register like so:

<form name="formname" action="/register" method="post">

EDIT: Wanted to add, if you're developing in a JS environment like node, you should consider having the form action being triggered with an event listener (syntax depending on if you're using jQuery / vue.js / React / Polymer etc) that:

  1. prevents the default submit action.
  2. makes an asynchronous call to the backend using AJAX.
  3. triggers some sort of re-rendering, if you're using ES5 you'll pass a call back function, or if you're using ES6 you can use the promise chain.
OneNeptune
  • 883
  • 11
  • 20
1

Alternatively, Issuing the below command will give you a randomized subdomain URL which you can make use of too.

lt –port 80

which will generate a URL like,

https://somerandomizedstring.localtunnel.me

And in your case you can use the generated URL+/regstier in your <form> tag's action, For example,

<form name="formname" action="https://somerandomizedstring.localtunnel.me/register" method="post">

Hope this helps!

David R
  • 14,711
  • 7
  • 54
  • 72