How to include parameters in url using nodejs+jade?

340 views Asked by At

In jade I have two hyper links that both jump to same page, for example:

a(href='/signup')#create-account Create Student Account
a(href='/signup')#create-admin Create Teacher Account

If I want a variable send to '/signup' url and do some processing using that variable, what should I do?

Any help will be appreciated.

1

There are 1 answers

2
cs04iz1 On BEST ANSWER

It depends on whether you will make your app to be RESTful or not. Saying you would like to be Restful. To create an admin you should make a POST to the url /admin. Respectively to create an account you should post to the url /account.

This is if admin and account are different resources. If it is the same recourse you should post to the original recourse and with the posted data, make the decision what to save where.

jade form:

  div.loginbox
    form(name="login", action="/signup", method="post")
      input(type="checkbox" name="admin")
      input(type="text", name="user")
      input(type="password", name="pass")
      input(type="submit", value="login")