Skip to content

Commit fc81a7a

Browse files
committed
fix: serverless.yml config
1 parent 35d883d commit fc81a7a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

server/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ async function cacheRender(req, res) {
2828
if (res.statusCode !== 200) {
2929
res.send(html);
3030
return;
31+
} else {
32+
Cache.set(key, html);
33+
res.setHeader('X-Cache', 'MISS');
34+
res.send(html);
3135
}
32-
Cache.set(key, html);
33-
res.setHeader('X-Cache', 'MISS');
34-
res.send(html);
3536
} catch (err) {
3637
res.statusCode = 500;
3738
app.renderError(err, req, res, reqPath, req.query);
@@ -52,11 +53,11 @@ async function startServer() {
5253
});
5354

5455
server.get('/user', async (req, res) => {
55-
return await cacheRender(req, res);
56+
return cacheRender(req, res);
5657
});
5758

5859
server.get('/about', async (req, res) => {
59-
return await cacheRender(req, res);
60+
return cacheRender(req, res);
6061
});
6162

6263
server.get('/login', async (req, res) => {

serverless.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ inputs:
3535
customDomains:
3636
- domain: ${env:APIGW_CUSTOM_DOMAIN}
3737
certificateId: ${env:APIGW_CUSTOM_DOMAIN_CERTID}
38+
isDefaultMapping: false
3839
pathMappingSet:
3940
- path: /
4041
environment: release

0 commit comments

Comments
 (0)