-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
刘江虹
committed
Sep 30, 2021
1 parent
157bf33
commit 4072e68
Showing
7 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,10 @@ export default app => { | |
|
||
|
||
} | ||
}, | ||
// koa-view模版配置 | ||
view: { | ||
extension: 'ejs' | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export default { | ||
method: 'GET', | ||
handler: (ctx) => { | ||
handler: async (ctx) => { | ||
ctx.body = "this is koa book." | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
export default { | ||
method: 'GET', | ||
handler: (ctx) => { | ||
ctx.body = "my name is liujianghong." | ||
handler: async (ctx) => { | ||
|
||
await ctx.render('404', { | ||
url: 'https://baidu.com', | ||
}) | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<style> | ||
html,body {text-align:left;font-size:1em;font-family:Courier,monospace;height:100%} | ||
html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd, | ||
h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0} | ||
ul,li{list-style:none} | ||
a{text-decoration:none;font-weight:normal;font-family:inherit} | ||
*{box-sizing:border-box} | ||
*:active,*:focus{outline:0;-moz-outline-style:none} | ||
h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em} | ||
.clearfix:after{clear:both;content:"";display:block;visibility:hidden} | ||
.wrap{min-height:100%;padding:60px 20px 100px;max-width:620px;margin:0 auto;} | ||
.footer{margin-top:-40px;height:20px;text-align:center;font-size:12px;font-weight:bold} | ||
.footer b{color: #F83F1D} | ||
.wrap h1,.wrap h2,.wrap p{text-align:center} | ||
.wrap h1{font-size:120px;line-height:120px;font-weight:bold;color: #5192b9;margin-top: 200px;} | ||
.wrap h2{font-size:30px;line-height:30px;font-weight:bold;margin-top:20px} | ||
.wrap p{margin-top:30px;font-size:20px;opacity:0.5;word-break:break-all;line-height:150%} | ||
.wrap pre{margin-top:30px;overflow-x:auto;border:1px solid #E5E5E5;padding:20px;border-radius:2px} | ||
</style> | ||
<div class="wrap"> | ||
<h1>302</h1> | ||
<h2>Moved Temporarily</h2> | ||
<p>The page will redirect to "<a href="<%= url %>"><%= url %></a>"</p> | ||
</div> | ||
<div class="footer">with <b>♥</b> by lianjia-fe</div> | ||
<script> location.replace(<%- JSON.stringify(url) %>) </script> | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<style> | ||
html,body {text-align:left;font-size:1em;font-family:Courier,monospace;height:100%} | ||
html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd, | ||
h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0} | ||
ul,li{list-style:none} | ||
a{text-decoration:none;font-weight:normal;font-family:inherit} | ||
*{box-sizing:border-box} | ||
*:active,*:focus{outline:0;-moz-outline-style:none} | ||
h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em} | ||
.clearfix:after{clear:both;content:"";display:block;visibility:hidden} | ||
.wrap{min-height:100%;padding:60px 20px 100px;max-width:620px;margin:0 auto;} | ||
.footer{margin-top:-40px;height:20px;text-align:center;font-size:12px;font-weight:bold} | ||
.footer b{color: #F83F1D} | ||
.wrap h1,.wrap h2,.wrap p{text-align:center} | ||
.wrap h1{font-size:120px;line-height:120px;font-weight:bold;color: #5192b9;margin-top: 200px;} | ||
.wrap h2{font-size:30px;line-height:30px;font-weight:bold;margin-top:20px} | ||
.wrap p{margin-top:30px;font-size:20px;opacity:0.5;word-break:break-all;line-height:150%} | ||
.wrap pre{margin-top:30px;overflow-x:auto;border:1px solid #E5E5E5;padding:20px;border-radius:2px} | ||
</style> | ||
<div class="wrap"> | ||
<h1>403</h1> | ||
<h2>Forbidden</h2> | ||
<p> | ||
<% if (typeof message !== 'undefined') { %> | ||
<%= message %> | ||
<% } else { %> | ||
You don't have permission to see the page you're trying to reach. | ||
<% } %> | ||
</p> | ||
</div> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<style> | ||
html,body {text-align:left;font-size:1em;font-family:Courier,monospace;height:100%} | ||
html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd, | ||
h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0} | ||
ul,li{list-style:none} | ||
a{text-decoration:none;font-weight:normal;font-family:inherit} | ||
*{box-sizing:border-box} | ||
*:active,*:focus{outline:0;-moz-outline-style:none} | ||
h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em} | ||
.clearfix:after{clear:both;content:"";display:block;visibility:hidden} | ||
.wrap{min-height:100%;padding:60px 20px 100px;max-width:620px;margin:0 auto;} | ||
.footer{margin-top:-40px;height:20px;text-align:center;font-size:12px;font-weight:bold} | ||
.footer b{color: #F83F1D} | ||
.wrap h1,.wrap h2,.wrap p{text-align:center} | ||
.wrap h1{font-size:120px;line-height:120px;font-weight:bold;color: #5192b9;margin-top: 200px;} | ||
.wrap h2{font-size:30px;line-height:30px;font-weight:bold;margin-top:20px} | ||
.wrap p{margin-top:30px;font-size:20px;opacity:0.5;word-break:break-all;line-height:150%} | ||
.wrap pre{margin-top:30px;overflow-x:auto;border:1px solid #E5E5E5;padding:20px;border-radius:2px} | ||
</style> | ||
<div class="wrap"> | ||
<h1>404</h1> | ||
<h2>Not Found</h2> | ||
<p> | ||
<% if (typeof message !== 'undefined') { %> | ||
<%= message %> | ||
<% } else { %> | ||
The page you were trying to reach doesn't exist. | ||
<% } %> | ||
</p> | ||
</div> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<style> | ||
html,body {text-align:left;font-size:1em;font-family:Courier,monospace;height:100%} | ||
html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd, | ||
h1,h2,h3,h4,h5,h6,pre,code{margin:0;padding:0} | ||
ul,li{list-style:none} | ||
a{text-decoration:none;font-weight:normal;font-family:inherit} | ||
*{box-sizing:border-box} | ||
*:active,*:focus{outline:0;-moz-outline-style:none} | ||
h1,h2,h3,h4,h5,h6,h7{font-weight:normal;font-size:1em} | ||
.clearfix:after{clear:both;content:"";display:block;visibility:hidden} | ||
.wrap{min-height:100%;padding:60px 20px 100px;max-width:620px;margin:0 auto;} | ||
.footer{margin-top:-40px;height:20px;text-align:center;font-size:12px;font-weight:bold} | ||
.footer b{color: #F83F1D} | ||
.wrap h1,.wrap h2,.wrap p{text-align:center} | ||
.wrap h1{font-size:120px;line-height:120px;font-weight:bold;color: #5192b9;margin-top: 200px;} | ||
.wrap h2{font-size:30px;line-height:30px;font-weight:bold;margin-top:20px} | ||
.wrap p{margin-top:30px;font-size:20px;opacity:0.5;word-break:break-all;line-height:150%} | ||
.wrap pre{margin-top:30px;overflow-x:auto;border:1px solid #E5E5E5;padding:20px;border-radius:2px} | ||
</style> | ||
<div class="wrap"> | ||
<h1>500</h1> | ||
<h2>Internal Server Error</h2> | ||
<p> Something isn't right here. </p> | ||
<% if (typeof error !== 'undefined') { %> | ||
<% if (error.stack && error.stack.indexOf(error.toString()) !== 0) { %> | ||
<pre><%= error.toString().replace(/\x1b\[\d+m/g, '') %></pre> | ||
<% } %> | ||
<pre><%= error.stack.replace(/\x1b\[\d+m/g, '') %></pre> | ||
<% } %> | ||
</div> |