-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP Resource Representation Variants #164
Merged
Merged
Changes from all commits
Commits
Show all changes
1191 commits
Select commit
Hold shift + click to select a range
12d364e
Migrate fixture path to resources/fixtures/
snuggs 1ee7d52
Update path to add current working directory
snuggs a6a8c80
update to use defined resource from directory location
snuggs 5abda0d
Update only test for Defined Resource disallowed methods
snuggs 6d83ccb
Update whitespace for test
snuggs 8440516
Test Get assets via subresource identity
snuggs 8fd6faf
Add koa-send
snuggs b41e4f8
Migrate send and mount capabilities
snuggs 79880e7
Setup test for Resource assets
snuggs 8f4ca6e
update get response for context body
snuggs 9177aee
Add link to pipped stream responses
snuggs db8840b
Add spec for http range requests
snuggs 6fd25a0
Add link to koa-stream
snuggs a2a29e5
Refactor koa-send from application
snuggs fdb882e
Refactor koa-send from application
snuggs 227b36b
Add test for Content-Length
snuggs 5be37b4
Migrate meta statistics helper in Resource
snuggs 8984a64
Add resources/fixtures/index.html
snuggs 35dc9c5
Add resources/fixtures/index.mjs
snuggs 6dcf4a3
Migrate filesystem requirement to head of Resource
snuggs e17f164
Remove console directory logging from Resource
snuggs 35874a5
Add test for subresource last-modified HTTP header
snuggs c77847f
Fix formatting in route.text
snuggs db70497
Fix bug in constant declaration
snuggs 24eabbd
Fix whitespace in Resource test
snuggs c3c38fe
Test GET subresource with predefined body
snuggs cb2b3c4
Add test for successful status with context
snuggs 106002d
Add test for successful subresource response body
snuggs f32db32
Update server to use hello endpoint
snuggs 5689f76
Add cat gif meow
snuggs c51c4c1
Update cat gif
snuggs 7c276fb
Add style for subresource example
snuggs 4d58b3c
Add image of cat
snuggs f1ed395
Add module and nomodule resources
snuggs 18408fe
Add index.js file
snuggs 6453a87
Update message for nomodule resource
snuggs bd46621
Test import module strategy
snuggs 80081cd
Add foo.mjs resource
snuggs 00674f2
Rename subresource foo.mjs to dependency.mjs
snuggs 563918c
Update imported dependency in subresource
snuggs 9f5c80c
Fix capitalization of log message
snuggs 76831aa
Add link to index overflow
snuggs 7a8fe49
Fix whitespace
snuggs d3ec2f6
Fix whitespace
snuggs 7f22093
Add koa link to real world app
snuggs eeeeaa7
Add link to real world app
snuggs 41d40bc
Promisify filesystem and stat
snuggs f30b99f
Convert old callback style to utility promise
snuggs 859111c
Do super.get test
snuggs bf1515e
Use better name for scanning file stats
snuggs e561940
Refactor send middleware
snuggs 0c7b144
Convert to use backticks
snuggs 1680a10
Refactor send middleware
snuggs ba723f4
Add root to filesystem
snuggs fe20894
Fix boolen path lookup
snuggs 26df9e8
Change only test
snuggs dc88aa8
Change only test for path lookup
snuggs 6062c58
Refactor base path to top includes
snuggs 8c8ed80
Fix formatting for included variables
snuggs a96d77a
Migrate default and safe methods
snuggs 43e9a75
Migrate base path
snuggs 760d780
normalize path from array
snuggs c597b39
Fix whitespace
snuggs 610511c
Fix formatting of context.body
snuggs 3531f30
fix ok test
snuggs 0ce3b94
Migrate Base factory in resource
snuggs bd3e206
Better naming convention for what is done /cc @tmornini
snuggs b0eece2
Add disable method
snuggs 4bfff97
Migrate property definition
snuggs 0e2ca04
Migrate property definition
snuggs e8e7215
Update method signature of disable
snuggs cca0609
Reformat allow includes
snuggs c3ec2b3
Fix header formatting
snuggs fc4c66c
Migrate response streams
snuggs ece185a
Refactor send Resource body/payload(?) /cc @tmornini
snuggs a425c1e
Refactor response headers into object
snuggs ada8201
Refactor Resource async send
snuggs 681e926
Refactor Base path logic. AKA sexy backflip
snuggs 20f56ca
Convert to backticks
snuggs a4cf196
Add whitespace
snuggs 6927722
Add whitespace
snuggs 9a95e9e
Format identify uri within Route implementation
snuggs c118546
Migrate identify uri closer to head of file
snuggs 6cd193c
Add message about non blocking io
snuggs 1cc63d7
Refactor promisify routine within Resource send
snuggs ce5914e
Reorder constants
snuggs cef74d0
Remove comment
snuggs dad08c1
Add whitespace
snuggs 30c03b8
Add whitespace
snuggs d239df1
Move comment for connect
snuggs 8da9be2
Update bug in constant definition
snuggs 064d877
Change export files
snuggs 001c754
Change only test
snuggs 57a7251
Change echo of file coverage
snuggs ae68f05
Change echo of file coverage
snuggs b16941a
Add only test
snuggs 428412d
Test console logging
snuggs ff49eef
Test console logging
snuggs e2c8a9b
Add const func
snuggs 23f1c10
Log tests for super.get
snuggs a94e2d1
fix whitespace for identity
snuggs c5783c3
do identity check for await send
snuggs 7cff916
Add const endpoint
snuggs 34838fe
Fix tests to run with full file
snuggs d8f0ffd
Add spec coverage to bin/test
snuggs 11e4bf2
Add ability to test single files
snuggs 5c59f99
Fix whitespacing
snuggs 73f0485
Remove unfinished breaking tests
snuggs 1e9cbcb
Fix whitespacing
snuggs fddb661
You know life is good when refactoring bash scripts.
snuggs 49e4053
Final refactor of bash script
snuggs 2fc7609
Update variable bug in bin/test
snuggs 2e38383
Log context body
snuggs 312b70d
Test logging of response body
snuggs ea78fcb
Convert to capitalized response headers
snuggs e1c3512
Deny GET */index.es subresource
snuggs 9514e39
Fix whitespace
snuggs bbedc4c
Add mount point comment
snuggs dc0c707
update whitespace of resource/index.es
snuggs a0e9111
fix Server test for public assets
snuggs 39377df
FULL 170+ ✅ test suite passing for the first time EVAR! #WOOT 🎉
snuggs 06d6aac
Add public/index.es
snuggs 96a51f1
Remove public/*.es from .gitignore
snuggs 2a2b5fe
Change node engine
snuggs 0349a0d
Refactor tests for full test suite passing
snuggs 25eb2ed
Fix middleware/snuggsi.es and middleware/snuggsi.test runs
snuggs 8416983
Enable middleware/snuggsi.test
snuggs bce17cc
Update middleware/snuggsi.test to reflect proper minification rules
snuggs f1a5b66
add test in middleware/snuggsi.test for GET / Accept: */*
snuggs 06bdc3b
test for snuggsi root hijacking
snuggs 14fb2b7
Test GET default subresource Accept: text/html
snuggs 21cea3a
Remove un necessary scripts from bin/publish
snuggs c80e3c4
Add back examples to public copying
snuggs faed285
Update start path of browser sync
snuggs 3998a56
Add short video clip
snuggs 8a248d2
Add video
snuggs 0f4e823
Add css file
snuggs 42d45e5
Add png image
snuggs 23d63e1
Add jpeg resource/fixture
snuggs ee215a1
Add audio segment
snuggs 8d82514
Add mp3 file
snuggs ae58431
Add resource/fixtures/index.ogg
snuggs 4aa3499
Add wav file
snuggs d824672
Add media figures
snuggs 789c6d6
Add block for caption
snuggs f7683b6
Add block formatting for resource/fixtures
snuggs fdbe87e
Add PDF Document
snuggs a021591
Add resources/fixtures/index.txt
snuggs 1295c1d
Add resources/fixtures/index.css
snuggs a349b85
Center everything
snuggs 2790bd6
Add margin
snuggs af87759
Add negotiator and remove extensions
snuggs 87d737d
Change index.es on server code
snuggs f837e29
Add logging for negotiator
snuggs c1edb81
Add negotiator tests
snuggs b0e92c1
Add negotiator to stack
snuggs 5bf4a51
Convert to use Accept header testing
snuggs 14bebfd
Convert to use Accept header testing
snuggs c72865a
Update whitespacing
snuggs ddf9968
Remove empty test from negotiator
snuggs 9350ddb
Update response testing for negotiator
snuggs 1b3e688
Update const definition order for negotiator
snuggs 4d529ec
Change cont variables
snuggs 247e0df
Refactor negotiator test
snuggs 8ea20f4
Refactor const variables
snuggs 8393a00
Refactor accepts testing for negotiation
snuggs 1607145
Refactor middleware/negotiator spec description
snuggs 7256522
Add tests for CDN distribution and caching of HTML and JSON
snuggs bb78cdc
Fix whitespacing
snuggs 255b5bd
Refactor audio controls
snuggs 91e75a6
Remove legacy media elements
snuggs 163645e
Add index.json resource
snuggs d4c2262
Use resource fixtures
snuggs 22014ee
Remove body test
snuggs 13c7846
Add accepts predicates
snuggs d48734b
Log acceptance criteria
snuggs 594a4d6
Fix bug in acceptance criteria
snuggs 4866f0f
Remove accept encoding
snuggs 95b3c16
Rearrange logging for acceptance criteria
snuggs 3c965d1
Migrate next callback routine
snuggs 808348e
Update console logging of acceptance criteria
snuggs 990f80a
refactor to use string template literals
snuggs 00d459e
Add comment for HEAD
snuggs 824c54a
Tests returning false positives
snuggs 923d4b4
Tests returning false positives
snuggs 364cfb8
Fix whitespacing
snuggs 89618f3
Convert to use backticks for date routing test
snuggs b17e3d2
Convert to use backticks for date routing test
snuggs 3ddcaee
Refactor route URI segment {token} parameters
snuggs bc2a1c1
Refactor middleware/route.test and use backticks
snuggs 879ba58
Refactor random math string for URI routing
snuggs 3ae6d50
Refactor to use backticks in resource implementation and test
snuggs 4969f72
Add test for route URI without endpoint
snuggs 064f800
Remove unnecessary string interpolation
snuggs 31497f0
Refactor middleware/route.es
snuggs 2225057
refactor middleware route.es
snuggs fa65ce9
Set default resource as 501 Not implemented
snuggs b2eb027
Refactor middleware/route.test
snuggs 2923b2a
Refactor middleware/route.test
snuggs 8f39bf9
Major refactor to middleware route.es
snuggs 13191d5
Reorganize method signature
snuggs 455062a
Fix whitespacing within middleware/route.es
snuggs 8032ed1
Refactor parameterizer within middleware/route.es
snuggs 2fbd3f9
Boss move refactor of params
snuggs bcda144
Migrate context.params side effect into parameterize
snuggs be962e2
Migrate comments to top of middleware/route.es
snuggs efe273a
Refactor into surrogate URI pattern
snuggs afc40b7
Rename surrogate to trailing
snuggs 6e0802a
Refactor to use backticks
snuggs 43884b6
Refactor tokenized uri
snuggs 568b9ee
reorder method signature for middleware/route.es
snuggs e2437a7
refactor tokenized uri parameters
snuggs 10deddf
Refactor constant instantiation within resource/index.es
snuggs a66e4a8
Add OPTIONS response
snuggs dcbbbff
Use backticks instead of function calls
snuggs 572b512
Refactor constructor of server/index.es
snuggs 0e921ef
Refactor constructor of server/index.test
snuggs f17ffe2
Add test for Server.close with backticks
snuggs 7a77b79
Update test definition within server/index.test
snuggs 8003aef
Update filtered HTTP METHODS
snuggs 57a9095
Refactor server/index.es and server/index.test
snuggs d47075a
Refactor trailing slash test from uri
snuggs 17d330b
Update test for surrogate subresource undefined identity
snuggs 0d1e6df
Implement Resource HTML GET / Accept: text/html
snuggs 145b6cc
Implement Resource HTML GET / Accept: text/txt
snuggs d8dc742
Implement Resource HTML GET / Accept: text/css
snuggs 33396bd
Implement Resource HTML GET / Accept: text/json
snuggs 9e7cc72
Implement Resource HTML GET / Accept: application/javascript
snuggs c07c0d0
FAILING TEST (Le Sigh 😞 )
snuggs e22bf1e
Update examples resource
snuggs 45f0871
Add examples route and resource to serve
snuggs 12b4ef8
Add caching ranges comment
snuggs 2c3e923
Add link to readFile being far slower
snuggs 303f21c
Add link to readFile being far slower
snuggs dedc259
Add link to koa-stream
snuggs 6ec9ecb
Add link to AWS requests using streams
snuggs ae72aad
Change resolve to then
snuggs 64d784f
Migrate join buffer
snuggs b9a482c
Refactor method signature for module export
snuggs a20c8b1
Refactor buffer out of read module and into join function
snuggs 63676ba
Remove bug from join source
snuggs 87c3518
Refactor join algorithm for stream buffer reading
snuggs a635878
Add whitespace to join
snuggs f4a4cd7
Add only test
snuggs 5586336
Remove package lock
snuggs 40a797f
Use backticks for context.accepts
snuggs 496585d
Update whitespace
snuggs 45169e9
Add comment for preload
snuggs f942161
Add comment for preload
snuggs 00dc115
Skip tests as per @tmornini recommendation /cc @brandondees
snuggs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -15,6 +15,5 @@ NOTES | |
.DS_Store | ||
public/*.html | ||
public/examples | ||
public/*.es | ||
public/*.css | ||
|
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 +1,16 @@ | ||
(new (require ('..').Server)).serve `public` | ||
const | ||
{ Server, Resource } | ||
= require ('..') | ||
|
||
, { route } | ||
= require ('../middleware') | ||
|
||
middleware = [ | ||
route (`/hello/`, Resource `/resource/fixtures/`) | ||
, route (`/examples/`, Resource `/examples/`) | ||
] | ||
|
||
void | ||
|
||
(new Server (middleware)) | ||
.serve `public` |
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,25 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Run tape | ||
|
||
# https://gist.github.com/branneman/8775568 | ||
# https://gist.github.com/branneman/8048520 | ||
# https://stackoverflow.com/questions/10265798/determine-project-root-from-a-running-node-js-application | ||
export ROOT=$(pwd) | ||
|
||
export PORT=8181 | ||
export ROOT=$(pwd) | ||
export API="element" | ||
export NODE_PATH=$ROOT | ||
export ENTRY="index.test" | ||
#export API="elements,token-list" | ||
#export PATHS="{test,middleware,mixins,$ELEMENTS}" | ||
export MODULES="{.,test,server,middleware,$API}" | ||
export FILES="$ROOT/$MODULES/$ENTRY" | ||
export COVERAGE="$ROOT/node_modules/.bin/tap-nyc" | ||
|
||
echo "Covering $MODULES" | ||
export TEST="$ROOT/node_modules/.bin/tape" | ||
export SPEC="$ROOT/node_modules/.bin/tap-spec" | ||
export COVER="$ROOT/node_modules/.bin/tap-nyc" | ||
export LIBRARIES=".,test,server,resource,middleware" | ||
export TESTS=$ROOT/${1:-"{$LIBRARIES,$API}/$ENTRY"} | ||
|
||
# https://gist.github.com/branneman/8775568 | ||
# https://gist.github.com/branneman/8048520 | ||
export NODE_PATH=$ROOT | ||
echo "Covering $TESTS" | ||
|
||
$ROOT/node_modules/.bin/tape \ | ||
--require ./ \ | ||
-- $FILES \ | ||
| $COVERAGE | ||
$TEST \ | ||
--require ./ \ | ||
-- $TESTS \ | ||
| $SPEC |
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,5 +1,7 @@ | ||
console.warn ('this is coming from examples wohoo') | ||
module.exports = | ||
|
||
const | ||
{ routes } | ||
= require ('./') | ||
class { | ||
get (context, element) { | ||
console.warn ('Getting', element) | ||
} | ||
} |
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,5 +1,6 @@ | ||
require ('./polyfills') | ||
|
||
module.exports = { | ||
Server : require ('server') | ||
Resource : require ('resource') | ||
, Server : require ('server') | ||
} |
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
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,3 +1,10 @@ | ||
module.exports = path => | ||
require ('koa-static') | ||
( path, { defer: true } ) | ||
const | ||
route | ||
= require ('./route') | ||
|
||
, Resource | ||
= require ('resource') | ||
|
||
|
||
module.exports = | ||
path => route ('/', Resource (`/${path}/`)) |
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,31 +1,27 @@ | ||
const | ||
{ test, browse, get } | ||
{ test, fetch } | ||
= require ('test') | ||
|
||
, { assets } | ||
= require ('.') | ||
|
||
, Server | ||
= require ('server') | ||
|
||
, request | ||
= require ('request') | ||
, { Server } | ||
= require ('..') | ||
|
||
|
||
test ('random location of assets') | ||
|
||
test ('assets', t => { | ||
test ('assets', async t => { | ||
|
||
const | ||
server | ||
= (new Server).serve `` | ||
|
||
request | ||
.get ('http://localhost:8181', response => { }) | ||
await fetch ('http://localhost:8181') | ||
|
||
|
||
t.ok (true) | ||
|
||
server.close () | ||
server.close `` | ||
t.end () | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @mrbernnz