clwy-express-generator 4.16.2 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/express-cli.js
CHANGED
|
@@ -197,7 +197,10 @@ function createApplication (name, dir, options, done) {
|
|
|
197
197
|
// Copy view templates
|
|
198
198
|
mkdir(dir, 'views')
|
|
199
199
|
pkg.dependencies['http-errors'] = '~1.7.2'
|
|
200
|
-
copyTemplateMulti(
|
|
200
|
+
copyTemplateMulti(
|
|
201
|
+
options.es6 ? 'mjs/middlewares' : 'js/middlewares',
|
|
202
|
+
dir + '/middlewares', '*.js'
|
|
203
|
+
)
|
|
201
204
|
|
|
202
205
|
switch (options.view) {
|
|
203
206
|
case 'dust':
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "clwy-express-generator",
|
|
3
3
|
"description": "Express' application generator",
|
|
4
4
|
"homepage": "https://github.com/clwy-cn/clwy-express-generator",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "5.0.1",
|
|
6
6
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
|
7
7
|
"contributors": [
|
|
8
8
|
"Aaron Heckmann <aaron.heckmann+github@gmail.com>",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// middlewares/error-handler.js
|
|
2
|
+
|
|
3
|
+
export default (err, req, res, next) => {
|
|
4
|
+
// set locals, only providing error in development
|
|
5
|
+
res.locals.message = err.message;
|
|
6
|
+
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
|
7
|
+
|
|
8
|
+
// render the error page
|
|
9
|
+
res.status(err.status || 500);
|
|
10
|
+
|
|
11
|
+
// if you want to use json, you can use res.json instead of res.render
|
|
12
|
+
// res.json({
|
|
13
|
+
// status: false,
|
|
14
|
+
// message: err.message
|
|
15
|
+
// });
|
|
16
|
+
res.render('error');
|
|
17
|
+
};
|
|
File without changes
|