Skip to content

Commit 1e1b723

Browse files
committed
FIXUP
1 parent 35a00b9 commit 1e1b723

File tree

16 files changed

+30
-35
lines changed

16 files changed

+30
-35
lines changed

hackernews-tegg/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# hackernews-async-ts
1+
# hackernews-tegg
22

3-
[Hacker News](https://news.ycombinator.com/) showcase using typescript && egg
3+
[Hacker News](https://news.ycombinator.com/) showcase using tegg
44

55
## QuickStart
66

@@ -29,5 +29,5 @@ $ npm start
2929

3030
### Requirement
3131

32-
- Node.js 16.x
33-
- Typescript 4.x
32+
- Node.js 22.x
33+
- Typescript 5.x
-3.04 KB
Binary file not shown.

hackernews-tegg/app/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Application } from 'egg';
33
export default (app: Application) => {
44
const { controller, router } = app;
55

6-
router.redirect('/', '/news');
6+
router.redirect('/', '/news', 302);
77
router.get('/news', controller.news.list);
88
router.get('/news/item/:id', controller.news.detail);
99
router.get('/news/user/:id', controller.news.user);

hackernews-tegg/app/view/layout/layout.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
66
<link rel="stylesheet" href="/public/css/news.css" />
7-
<link rel="icon" href="/public/favicon.png" type="image/x-icon">
7+
<link rel="icon" href="https://eggjs.org/favicon.png" type="image/x-icon">
88
<title>{% block title %}egg - HackerNews{% endblock %}</title>
99
</head>
1010
<body>
1111
<div id="wrapper">
1212
<div id="header">
13-
<a id="yc" href="http://www.ycombinator.com"><img src="https://news.ycombinator.com/y18.gif"></a>
13+
<a id="yc" href="http://www.ycombinator.com"><img src="https://news.ycombinator.com/y18.svg"></a>
1414
<h1><a href="/news">Hacker News</a></h1>
1515
<span class="source">
16-
Built with <a href="https://eggjs.org/" target="_blank">Egg</a> | <a href="https://github.com/eggjs/examples/tree/master/hackernews-async-ts" target="_blank">Source</a>
16+
Built with <a href="https://eggjs.org/" target="_blank">Egg</a> | <a href="https://github.com/eggjs/examples/tree/master/hackernews-tegg" target="_blank">Source</a>
1717
</span>
1818
</div>
1919
{% block content %}{% endblock %}

hackernews-tegg/config/config.default.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import fs from 'node:fs';
2-
import path from 'node:path';
3-
41
import { defineConfigFactory, type EggAppConfig } from 'egg';
52

63
// for config.{env}.ts
@@ -26,7 +23,7 @@ export default defineConfigFactory(appInfo => {
2623
},
2724
},
2825
siteFile: {
29-
'/favicon.ico': fs.readFileSync(path.join(appInfo.baseDir, 'app/public/favicon.png')),
26+
'/favicon.ico': 'https://eggjs.org/favicon.png',
3027
},
3128
// app special config
3229
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,

hackernews-tegg/config/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
nunjucks: {
33
enable: true,
4-
package: 'egg-view-nunjucks',
4+
package: '@eggjs/view-nunjucks',
55
},
66
};

hackernews-tegg/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
"clean": "tsc -b --clean"
2121
},
2222
"dependencies": {
23-
"egg": "beta",
2423
"@eggjs/scripts": "beta",
2524
"@eggjs/tegg": "beta",
2625
"@eggjs/tegg-config": "beta",
2726
"@eggjs/tegg-controller-plugin": "beta",
2827
"@eggjs/tegg-plugin": "beta",
29-
"egg-view-nunjucks": "beta",
28+
"@eggjs/view-nunjucks": "beta",
29+
"egg": "beta",
3030
"moment": "^2.30.1"
3131
},
3232
"devDependencies": {
3333
"@eggjs/bin": "beta",
3434
"@eggjs/mock": "beta",
3535
"@eggjs/tsconfig": "beta",
3636
"@types/mocha": "10",
37-
"@types/node": "^24.8.1",
37+
"@types/node": "24",
3838
"eslint": "8",
3939
"eslint-config-egg": "14",
4040
"typescript": "5"

hackernews-tegg/test/app/controller/news.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import assert from 'node:assert/strict';
22

3-
// import cheerio from 'cheerio';
43
import { app } from '@eggjs/mock/bootstrap';
54

65
describe('test/app/controller/news.test.ts', () => {
76
it('should GET /news', async () => {
87
const result = await app.httpRequest().get('/news').expect(200);
9-
assert.equal(result.text.length, app.config.news.pageSize);
8+
const m = result.text.match(/<span class="index">.*?<\/span>/g);
9+
assert.ok(m);
10+
assert.equal(m.length, app.config.news.pageSize);
1011
});
1112

1213
it('should GET /news/item/:id', async () => {

hackernews-typescript/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# hackernews-typescript
22

3-
[Hacker News](https://news.ycombinator.com/) showcase using egg@4 and TypeScript
3+
[Hacker News](https://news.ycombinator.com/) showcase using typescript && egg
44

55
## QuickStart
66

@@ -31,4 +31,3 @@ $ npm start
3131

3232
- Node.js 22.x
3333
- Typescript 5.x
34-
- egg@4.x
-3.04 KB
Binary file not shown.

0 commit comments

Comments
 (0)