forked from 205CDE-1819JANMAY/TEACHING-MATERIALS
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
126 additions
and
44 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
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,18 @@ | ||
#!/usr/bin/env node | ||
|
||
const Koa = require('koa') | ||
const Router = require('koa-router') | ||
const views = require('koa-views') | ||
const stat = require('koa-static') | ||
|
||
const app = new Koa() | ||
const router = new Router() | ||
app.use(stat('public')) | ||
app.use(views(`${__dirname}/views`, { extension: 'html' }, {map: { handlebars: 'handlebars' }})) | ||
app.use(router.routes()) | ||
|
||
const port = 8080 | ||
|
||
router.get('/', async ctx => await ctx.render('hello')) | ||
|
||
module.exports = app.listen(port, () => console.log(`listening on port ${port}`)) |
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 @@ | ||
{ | ||
"name": "koa-intro", | ||
"version": "1.0.0", | ||
"description": "Simple Koa Web App", | ||
"main": "index.js", | ||
"scripts": { | ||
"server": "node index.js", | ||
"test": "./node_modules/.bin/jest" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"verbose": true | ||
}, | ||
"author": "Mark Tyers", | ||
"license": "ISC", | ||
"dependencies": { | ||
"http-status-codes": "^1.3.0", | ||
"koa": "^2.7.0", | ||
"koa-router": "^7.4.0", | ||
"koa-static": "^5.0.0", | ||
"koa-views": "^6.1.5" | ||
}, | ||
"devDependencies": { | ||
"jest": "^24.1.0", | ||
"supertest": "^3.4.2" | ||
} | ||
} |
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,4 @@ | ||
|
||
h1 { | ||
color: red; | ||
} |
BIN
+11.1 KB
exercises/04_koa/public/images/computer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 @@ | ||
|
||
<!doctype html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Let's see CSS at Work</title> | ||
<meta name="description" content="Simple Web Page"> | ||
<meta name="author" content="Mark Tyers"> | ||
<link href="css/hello.css" type="text/css" rel="stylesheet" /> | ||
</head> | ||
<body> | ||
<h1>Hello CSS!</h1> | ||
<p>Use this file to see how CSS can be used to change the appearance of a web page.</p> | ||
</body> | ||
</html> |