-
Notifications
You must be signed in to change notification settings - Fork 738
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
Showing
12 changed files
with
67 additions
and
68 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 |
---|---|---|
@@ -1,38 +1,33 @@ | ||
# egg-example-hackernews-async | ||
# hackernews-async-ts | ||
|
||
[Hacker News](https://news.ycombinator.com/) showcase using async/await for egg | ||
[Hacker News](https://news.ycombinator.com/) showcase using typescript && egg | ||
|
||
## QuickStart | ||
|
||
### Development | ||
```shell | ||
$ npm install | ||
$ npm run tsc:w | ||
|
||
```bash | ||
$ npm i | ||
$ npm run dev | ||
$ open http://localhost:7001/ | ||
``` | ||
|
||
### Deploy | ||
Don't tsc compile at development mode, if you had run `tsc` then you need to `npm run clean` before `npm run dev`. | ||
|
||
Use `EGG_SERVER_ENV=prod` to enable prod mode | ||
### Deploy | ||
|
||
```shell | ||
$ EGG_SERVER_ENV=prod npm start | ||
```bash | ||
$ npm run tsc | ||
$ npm start | ||
``` | ||
|
||
### Npm Scripts | ||
|
||
- Use `npm run autod` to auto detect dependencies upgrade | ||
- Use `npm run lint` to check code style | ||
- Use `npm test` to run unit test | ||
- se `npm run clean` to clean compiled js at development mode once | ||
|
||
### Requirement | ||
|
||
Please ensure your node version is `>=7.6.0` for async await support without flag. If your node version is `>=7.0.0 < 7.6.0`, you can run npm scripts with harmony flag | ||
|
||
```shell | ||
# start server | ||
npm run dev -- --harmony-async-await | ||
# run test cases | ||
npm run test-local -- --harmony-async-await | ||
``` | ||
- Node.js 8.x | ||
- Typescript 2.8+ |
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
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
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
File renamed without changes.
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
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
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,7 +1,8 @@ | ||
exports.static = true; | ||
'use strict'; | ||
|
||
exports.nunjucks = { | ||
enable: true, | ||
package: 'egg-view-nunjucks', | ||
export default { | ||
nunjucks: { | ||
enable: true, | ||
package: 'egg-view-nunjucks', | ||
}, | ||
}; | ||
|
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
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
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,10 +1,10 @@ | ||
// This file was auto created by egg-ts-helper | ||
// Do not modify this file!!!!!!!!! | ||
|
||
import HackerNews from '../../../app/service/HackerNews'; | ||
import News from '../../../app/service/News'; | ||
|
||
declare module 'egg' { | ||
interface IService { | ||
hackerNews: HackerNews; | ||
news: News; | ||
} | ||
} |
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,8 +1,3 @@ | ||
// extend egg | ||
declare module 'egg' { | ||
type PowerPartial<T> = { | ||
[U in keyof T]?: T[U] extends {} | ||
? { [V in keyof T[U]]?: T[U][V] extends {} ? Partial<T[U][V]> : T[U][V] } | ||
: T[U] | ||
}; | ||
|
||
} |