Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Apps Script url "routes"

I realize this is just because I'm dense, but...

What's a simple way to implement the "routing" functionality that's common in most modern web app frameworks (Rails, Sinatra, etc)?

like image 971
themirror Avatar asked Jan 24 '26 02:01

themirror


1 Answers

You cannot use an url like .../dev/pageToRouteTo and then access 'pageToRouteTo' from the doGet()

What you can do, is use a parameter e.g. .../dev?NextPage=pageToRouteTo and then

run code like:

function doGet(e){
  if('parameters' in e && 'NextPage' in e.parameters){
     loadPage(e.parameters.NextPage[0])
  }
}
like image 129
Karl S Avatar answered Jan 25 '26 19:01

Karl S