Skip to content

Instantly share code, notes, and snippets.

@prigara
Last active January 4, 2020 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save prigara/c6832f94c842a3ca9bcb5d8658ac8329 to your computer and use it in GitHub Desktop.
Save prigara/c6832f94c842a3ca9bcb5d8658ac8329 to your computer and use it in GitHub Desktop.
In the sample app (https://github.com/JetBrains/webstorm-samples/tree/master/Express) replace routes/index.js with this file to follow the steps in the tutorial: http://blog.jetbrains.com/webstorm/2018/01/how-to-debug-with-webstorm/
var express = require("express");
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Welcome!' });
next()
});
router.get('/:lang', function (req, res) {
if (req.params.lang === "de") {
res.render('index', {title: 'Willkommen!'});
}
else {
res.render('index', { title: 'Welcome!' });
}
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment