-
Notifications
You must be signed in to change notification settings - Fork 186
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
1 parent
8c3261a
commit d8c1b5b
Showing
7 changed files
with
78 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const options = { | ||
baseDir: __dirname, | ||
plugin: null | ||
}; | ||
|
||
const { EggCore: Application } = require('egg-core'); | ||
const app = new Application(options); | ||
|
||
app.loader.loadConfig(); | ||
app.loader.loadController(); | ||
|
||
|
||
require('./app/router')(app); | ||
|
||
|
||
module.exports = app; | ||
|
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,13 @@ | ||
'use strict'; | ||
|
||
const Controller = require('egg').Controller; | ||
|
||
class FooController extends Controller { | ||
async render() { | ||
const ctx = this.ctx; | ||
|
||
ctx.body = 'Hello foo'; | ||
} | ||
} | ||
|
||
module.exports = FooController; |
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,12 @@ | ||
'use strict'; | ||
|
||
const Controller = require('egg').Controller; | ||
|
||
class HomeController extends Controller { | ||
async render() { | ||
const ctx = this.ctx; | ||
ctx.body = 'Hello Egg'; | ||
} | ||
} | ||
|
||
module.exports = HomeController; |
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,8 @@ | ||
'use strict'; | ||
|
||
module.exports = app => { | ||
app.router.get('/egg/', app.controller.home.render); | ||
app.router.get('/egg/home', app.controller.home.render); | ||
app.router.get('/egg/foo', app.controller.foo.render); | ||
}; | ||
|
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,7 @@ | ||
{ | ||
"name": "helloworld.egg", | ||
"dependencies": { | ||
"egg": "^1.10.1" | ||
}, | ||
"private": true | ||
} |
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,11 +1,13 @@ | ||
{ | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"koa": "*", | ||
"egg": "^2.9.1", | ||
"express": "*", | ||
"hapi": "*" | ||
"hapi": "*", | ||
"koa": "*" | ||
}, | ||
"engines": { | ||
"node": ">= 8.0.0" | ||
} | ||
}, | ||
"private": true | ||
} |
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