Search code examples
javascriptangularjsrestrouteshashbang

hashbang #! url patterns for REST on the client side


I've a single page application with my own custom router.

window.onhashchange = function(event) {...

and I've hash bangs like following.

#!/products
#!/products/1

#!/brands
#!/brands/1

But they seem to emphasize GET requests, I'm listening to URL changes and is there a REST based convention clean URL's based on industry standard, perhaps used by angular, React etc. to indicate a POST request or DELETE request.

So router can dispatch a respective call accordingly.


Solution

  • hashbang urls are not meant to indicate any REST based remote calls, instead it's used to define to state of a SPA page it's currently in. State means the kind of content that's visible for the specific hash bang url.

    for instance for #!/products display product related forms, controls and associated content and vice versa for #!/brands.

    It's the user actions on the associated content that the developer needs to interpret and translate them into REST specific calls.