Lloyd Brookes
9 years ago
11 changed files with 338 additions and 58 deletions
-
106README.md
-
8example/mock/.local-web-server.json
-
7example/mock/css/style.css
-
8example/mock/index.html
-
9example/mock/index.js
-
3example/mock/mocks/data.json
-
5example/mock/mocks/five.js
-
4example/mock/mocks/four.js
-
106jsdoc2md/README.hbs
-
6lib/local-web-server.js
-
134test/test.js
@ -1,7 +0,0 @@ |
|||
body { |
|||
background-color: #AA3939; |
|||
color: #FFE2E2 |
|||
} |
|||
svg { |
|||
fill: #000 |
|||
} |
@ -1,8 +0,0 @@ |
|||
<head> |
|||
<link rel="stylesheet" href="css/style.css"> |
|||
</head> |
|||
<h1>Mock responses</h1> |
|||
<ul> |
|||
<li>list data</li> |
|||
</ul> |
|||
<script src="bundle.js"></script> |
@ -1,9 +0,0 @@ |
|||
'use strict' |
|||
const request = require('req-then') |
|||
const $ = document.querySelector.bind(document) |
|||
|
|||
request('http://localhost:8000/tree').then(response => { |
|||
$('ul').innerHTML = JSON.parse(response.data).map(tree => { |
|||
return `<li>${tree.name}</li>` |
|||
}).join('') |
|||
}) |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"one": "static data" |
|||
} |
@ -1,8 +1,5 @@ |
|||
module.exports = { |
|||
response: function (ctx, id, name) { |
|||
this.body = { |
|||
id: id, |
|||
name: name |
|||
} |
|||
ctx.body = `<h1>id: ${id}, name: ${name}</h1>` |
|||
} |
|||
} |
@ -1,5 +1,7 @@ |
|||
const fs = require('fs') |
|||
|
|||
module.exports = { |
|||
response: { |
|||
body: { id: 2, name: 'eucalyptus', maxHeight: 210 } |
|||
body: fs.createReadStream(__filename) |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue