Is it possible to define a catch-all route or an error route in Sammy.js? I know that I can be attached to an "error", but if the route does not match, which does not seem to work.
Thanks!
According to the documentation for Sammy routes ,
Paths can be defined as strings or regular expressions.
Thus, at the end of your routes it should be possible to create a route that is common to all:
get(/.*/, function() { ... });
You must override the notFound function.
notFound
Like this:
var app = $.sammy('#app', function() { this.notFound = function(){ // do something } });
This is recommended by author Sammy.
Source: https://habr.com/ru/post/650321/More articles:How to access the first key of an "associative array in JavaScript"? - javascriptundefined link to `forkpty '- c ++Prefix for testing methods in Unit: "test" vs "should" - javaProgrammatically "unselect" jQuery UI selectable widget - jqueryBidirectional encryption / decryption? - phpDifferent instances of Applicationcontext in Broadcastreceiver - androidecho-e equivalent on windows? - windowsHow to check if two instances of the same Java program are running? - javaPython OpenCV: Detecting the general direction of movement? - pythonis the Flying Saucer project closed? - javaAll Articles