/express-versioned-route-test

express-versioned-route-test

Primary LanguageJavaScript

express-versioned-route-test

express-versioned-route-test

##usage:
  npm install
  gulp

##Introduction:

This is a versioned route manage project based on express 4.X, A clean way to realize versioning.
Thanks to this article: https://medium.com/@jamsesso/versioning-rest-api-routes-in-express-js-f7287e1c8886 Thanks for the idea and awesome implemention

#function:
get localhost/3003/users -> v1_1 users
get localhost/3003/v1_1/users -> v1_1 users
get localhost/3003/v1_3/users -> v1_1 users (v1_2 don't have this method, so when visit v1_2, it'll get v1_1)
get localhost/3003/v2_1/companies -> v1_3 companies
...

##category:
-controllers
  |-- v1_1
      |-- company.js
      |-- user.js
  |-- v1_3
      |-- company.js
  |-- v2_1
      |-- user.js
-routes
  |-- v1_1
      |-- company.js
      |-- user.js
  |-- v1_3
      |-- company.js
      |-- user.js
  |-- v2_1
      |-- company.js
      |-- user.js