Last active
February 8, 2016 20:03
-
-
Save Retsam/9b1a425cea164f5cb2fd to your computer and use it in GitHub Desktop.
App Versioning Structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import v1 from "./v1" | |
import v2 from "./v2" | |
import express from "express"; | |
var app = express(); | |
app.use("/v1", v1); | |
app.use("/v2", v2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
getFoo: function (req, res) {}, | |
//This controller method had a breaking change, needed a second version | |
getFooV2: function (req, res) {}, | |
saveFoo: function (req, res) {} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fooController from "./fooController"; | |
import express from "express"; | |
var appV1 = express(); | |
appV1.get("/foo", fooController.getFoo); | |
appV1.put("/foo", fooController.saveFoo); | |
export default appV1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fooController from "./fooController"; | |
import express from "express"; | |
var appV2 = express(); | |
appV2.get("/foo", fooController.getFooV2); //This changed, so use the new version | |
appV2.put("/foo", fooController.saveFoo); //This didn't change, use the old version | |
epxort default appV2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment