diff --git a/.jekyll-metadata b/.jekyll-metadata index beefda1a..4fc0d14a 100644 Binary files a/.jekyll-metadata and b/.jekyll-metadata differ diff --git a/_config.yml b/_config.yml index af600d55..2dec78b1 100644 --- a/_config.yml +++ b/_config.yml @@ -2,3 +2,5 @@ # Build settings markdown: kramdown +gems: + - jekyll-redirect-from diff --git a/_includes/api/en/4x/app-METHOD.md b/_includes/api/en/4x/app-METHOD.md index 9143e47a..939d280d 100644 --- a/_includes/api/en/4x/app-METHOD.md +++ b/_includes/api/en/4x/app-METHOD.md @@ -4,7 +4,7 @@ Routes an HTTP request, where METHOD is the HTTP method of the request, such as PUT, POST, and so on, in lowercase. Thus, the actual methods are `app.get()`, `app.post()`, `app.put()`, and so on. See below for the complete list. -For more information, see the [routing guide](/guide/routing.html). +For more information, see the [routing guide](/{{ page.lang }}/guide/routing.html). Express supports the following routing methods corresponding to the HTTP methods of the same names: @@ -46,7 +46,7 @@ Express supports the following routing methods corresponding to the HTTP methods
- Read [Express behind proxies](/guide/behind-proxies.html) for more + Read [Express behind proxies](/{{ page.lang }}/guide/behind-proxies.html) for more information.
diff --git a/_includes/api/en/4x/app-use.md b/_includes/api/en/4x/app-use.md index bc99736c..9b7c6857 100644 --- a/_includes/api/en/4x/app-use.md +++ b/_includes/api/en/4x/app-use.md @@ -1,11 +1,11 @@/".
For example: app.use('/apple', ...) will match "/apple", "/apple/images",
- "/apple/images/news", and so on.
+ "/apple/images/news", and so on.
$ DEBUG=express:* node ./bin/www
diff --git a/guide/error-handling.md b/en/guide/error-handling.md
similarity index 96%
rename from guide/error-handling.md
rename to en/guide/error-handling.md
index 2a72bd38..5f0f2e90 100755
--- a/guide/error-handling.md
+++ b/en/guide/error-handling.md
@@ -4,6 +4,7 @@ layout: page
title: Express error handling
menu: guide
lang: en
+redirect_from: "/guide/error-handling.html"
### END HEADER BLOCK - BEGIN GENERAL TRANSLATION
---
@@ -87,11 +88,11 @@ If you pass anything to the `next()` function (except the string `'route'`), Exp
If you have a route handler with multiple callback functions you can use the `route` parameter to skip to the next route handler. For example:
-app.get('/a_route_behind_paywall',
+app.get('/a_route_behind_paywall',
function checkIfPaidSubscriber(req, res, next) {
- if(!req.user.hasPaid) {
-
- // continue handling this request
+ if(!req.user.hasPaid) {
+
+ // continue handling this request
next('route');
}
}, function getPaidContent(req, res, next) {
@@ -100,7 +101,7 @@ app.get('/a_route_behind_paywall',
res.json(doc);
});
});
-
+
In this example, the `getPaidContent` handler will be skipped but any remaining handlers in `app` for `/a_route_behind_paywall` would continue to be executed.
diff --git a/guide/migrating-4.md b/en/guide/migrating-4.md
similarity index 98%
rename from guide/migrating-4.md
rename to en/guide/migrating-4.md
index 37038200..bbfff8af 100755
--- a/guide/migrating-4.md
+++ b/en/guide/migrating-4.md
@@ -4,6 +4,7 @@ layout: page
title: Migrating to Express 4
menu: guide
lang: en
+redirect_from: "/guide/migrating-4.html"
### END HEADER BLOCK - BEGIN GENERAL TRANSLATION
---
@@ -126,7 +127,7 @@ new features to help organize your routes:
The new `app.route()` method enables you to create chainable route handlers
for a route path. Because the path is specified in a single location, creating modular routes is helpful, as is reducing redundancy and typos. For more
-information about routes, see [`Router()` documentation](/4x/api.html#router).
+information about routes, see [`Router()` documentation](/{{ page.lang }}/4x/api.html#router).
Here is an example of chained route handlers that are defined by using the `app.route()` function.
@@ -219,7 +220,7 @@ The `http` module is no longer needed, unless you need to directly work with it
`app.configure()`
$ DEBUG=myapp:* npm start
diff --git a/starter/hello-world.md b/en/starter/hello-world.md
similarity index 83%
rename from starter/hello-world.md
rename to en/starter/hello-world.md
index 55574657..f013f71a 100755
--- a/starter/hello-world.md
+++ b/en/starter/hello-world.md
@@ -4,16 +4,17 @@ layout: page
title: Express "Hello World" example
menu: starter
lang: en
+redirect_from: "/starter/hello-world.html"
### END HEADER BLOCK - BEGIN GENERAL TRANSLATION
---
# Hello world example
-This is essentially going to be the simplest Express app you can create. It is a single file app — _not_ what you'd get if you use the [Express generator](/starter/generator.html), which creates the scaffolding for a full app with numerous JavaScript files, Jade templates, and sub-directories for various purposes.
+This is essentially going to be the simplest Express app you can create. It is a single file app — _not_ what you'd get if you use the [Express generator](/{{ page.lang }}/starter/generator.html), which creates the scaffolding for a full app with numerous JavaScript files, Jade templates, and sub-directories for various purposes.
-First create a directory named `myapp`, change to it and run `npm init`. Then install `express` as a dependency, as per the [installation guide](/starter/installing.html).
+First create a directory named `myapp`, change to it and run `npm init`. Then install `express` as a dependency, as per the [installation guide](/{{ page.lang }}/starter/installing.html).
In the `myapp` directory, create a file named `app.js` and add the following code:
diff --git a/starter/installing.md b/en/starter/installing.md
similarity index 97%
rename from starter/installing.md
rename to en/starter/installing.md
index 4c52b29f..109daafd 100755
--- a/starter/installing.md
+++ b/en/starter/installing.md
@@ -4,6 +4,7 @@ layout: page
title: Installing Express
menu: starter
lang: en
+redirect_from: "/starter/installing.html"
### END HEADER BLOCK - BEGIN GENERAL TRANSLATION
---
diff --git a/starter/static-files.md b/en/starter/static-files.md
similarity index 95%
rename from starter/static-files.md
rename to en/starter/static-files.md
index e07a4fc2..15d1f8de 100755
--- a/starter/static-files.md
+++ b/en/starter/static-files.md
@@ -4,6 +4,7 @@ layout: page
title: Serving static files in Express
menu: starter
lang: en
+redirect_from: "/starter/static-files.html"
### END HEADER BLOCK - BEGIN GENERAL TRANSLATION
---
@@ -40,7 +41,7 @@ app.use(express.static('files'));
The files are looked up in the order in which you set the static directories by using the `express.static` middleware function.
-If you want to create a virtual path prefix (where the path does not actually exist in the file system) for the files that are served by the `express.static` function, you can [specify a mount path](/4x/api.html#app.use) for the static directory, as shown below:
+If you want to create a virtual path prefix (where the path does not actually exist in the file system) for the files that are served by the `express.static` function, you can [specify a mount path](/{{ page.lang }}/4x/api.html#app.use) for the static directory, as shown below:
app.use('/static', express.static('public'));