SHARE
TWEET

Untitled

a guest May 6th, 2017 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*globals Navigo */
  2. import { home } from 'homeController';
  3. import { login } from 'loginController';
  4. import { register } from 'registerController';
  5. import { sell } from 'sellController';
  6. import { buy } from 'buyController';
  7. import { about } from 'aboutController';
  8. import { contact } from 'contactController';
  9. import { faq } from 'faqController';
  10. import { profile } from 'profileController';
  11.  
  12. (function routing() {
  13.  
  14.     let router = new Navigo(null, true);
  15.  
  16.     router
  17.  
  18.         .on(function () {
  19.             home();
  20.         })
  21.  
  22.         .on('/sell', sell)
  23.  
  24.         .on('/buy', buy)
  25.  
  26.         .on('/about', about)
  27.  
  28.         .on('/contact', contact)
  29.  
  30.         .on('/FAQ', faq)
  31.  
  32.         .on('/login', login)
  33.  
  34.         .on('/register', register)
  35.  
  36.         .on('/profile', profile)
  37.  
  38.         //When we have user with ID
  39.         .on('/user/:id/:action', function (params) {
  40.             // If we have http://site.com/user/42/save as a url then
  41.             // params.id = 42
  42.             // params.action = save
  43.         })
  44.  
  45.         //GET Request
  46.         .on('/user/:id/:action', function (params, query) {
  47.             // If we have http://site.com/user/42/save?answer=42 as a url then
  48.             // params.id = 42
  49.             // params.action = save
  50.             // query = answer=42
  51.         })
  52.  
  53.         .resolve();
  54.  
  55.     //Not found
  56.     router.notFound(function (query) {
  57.         // ...
  58.     });
  59. }());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top