@@ -13,49 +13,53 @@ Roads is a simple web framework. It's similar to Express.js, but has some very i
13
13
![ Build status] ( https://travis-ci.org/Dashron/roads.svg?branch=master )
14
14
15
15
# Table of Contents
16
+ - [ The Roads.js isomorphic web framework] ( #the-roadsjs-isomorphic-web-framework )
17
+ - [ Why should I use Roads?] ( #why-should-i-use-roads )
18
+ - [ Build Status] ( #build-status )
19
+ - [ Table of Contents] ( #table-of-contents )
16
20
- [ Getting Started] ( #getting-started )
17
21
- [ Road] ( #road )
18
- - [new Road()](#new-road)
19
- - [use(fn *Function*)](#usefn-function)
20
- - [Middleware](#middleware)
21
- - [How do I control the order of my middleware?](#how-do-i-control-the-order-of-my-middleware)
22
- - [Context](#context)
23
- - [Typing your context](#typing-your-context)
24
- - [request(method: *string*, url: *string*, body?: *string*, headers?: *object*)](#requestmethod-string-url-string-body-string-headers-object)
22
+ - [ new Road()] ( #new-road )
23
+ - [ use(fn * Function* )] ( #usefn-function )
24
+ - [ Middleware] ( #middleware )
25
+ - [ How do I control the order of my middleware?] ( #how-do-i-control-the-order-of-my-middleware )
26
+ - [ Context] ( #context )
27
+ - [ Typing your context] ( #typing-your-context )
28
+ - [ request(method: * string* , url: * string* , body?: * string* , headers?: * object* )] ( #requestmethod-string-url-string-body-string-headers-object )
25
29
- [ Response] ( #response )
26
- - [new Response(body: *string*, status?: *number*, headers?: *object*)](#new-responsebody-string-status-number-headers-object)
27
- - [Body](#body)
28
- - [Status](#status)
29
- - [Headers](#headers)
30
+ - [ new Response(body: * string* , status?: * number* , headers?: * object* )] ( #new-responsebody-string-status-number-headers-object )
31
+ - [ Body] ( #body )
32
+ - [ Status] ( #status )
33
+ - [ Headers] ( #headers )
30
34
- [ Bundled Middleware] ( #bundled-middleware )
31
- - [Cookies](#cookies)
32
- - [serverMiddleware](#servermiddleware)
33
- - [buildClientMiddleware(pageDocumenet: *Document*)](#buildclientmiddlewarepagedocumenet-document)
34
- - [Cookie Context](#cookie-context)
35
- - [setCookie(name: *string*, value?: *string*, options?: *object*)](#setcookiename-string-value-string-options-object)
36
- - [getCookies()](#getcookies)
37
- - [CORS](#cors)
38
- - [Parsing request bodies](#parsing-request-bodies)
39
- - [Parse Body Context](#parse-body-context)
40
- - [Remove trailing slash](#remove-trailing-slash)
41
- - [Basic router](#basic-router)
42
- - [applyMiddleware(road: *Road*)](#applymiddlewareroad-road)
43
- - [addRoute(method: *string*, path: *string*, fn: *function*)](#addroutemethod-string-path-string-fn-function)
44
- - [addRouteFile(filePath: *string*, prefix?: *string*)](#addroutefilefilepath-string-prefix-string)
45
- - [If-Modified-Since caching](#if-modified-since-caching)
46
- - [checkModifiedSince(date: string | Date)](#checkmodifiedsincedate-string--date)
47
- - [buildNotModifiedResponse()](#buildnotmodifiedresponse)
35
+ - [ Cookies] ( #cookies )
36
+ - [ serverMiddleware] ( #servermiddleware )
37
+ - [ buildClientMiddleware(pageDocumenet: * Document* )] ( #buildclientmiddlewarepagedocumenet-document )
38
+ - [ Cookie Context] ( #cookie-context )
39
+ - [ setCookie(name: * string* , value?: * string* , options?: * object* )] ( #setcookiename-string-value-string-options-object )
40
+ - [ getCookies()] ( #getcookies )
41
+ - [ CORS] ( #cors )
42
+ - [ Parsing request bodies] ( #parsing-request-bodies )
43
+ - [ Parse Body Context] ( #parse-body-context )
44
+ - [ Remove trailing slash] ( #remove-trailing-slash )
45
+ - [ Basic router] ( #basic-router )
46
+ - [ applyMiddleware(road: * Road* )] ( #applymiddlewareroad-road )
47
+ - [ addRoute(method: * string* , path: * string* , fn: * function* )] ( #addroutemethod-string-path-string-fn-function )
48
+ - [ addRouteFile(filePath: * string* , prefix?: * string* )] ( #addroutefilefilepath-string-prefix-string )
49
+ - [ If-Modified-Since caching] ( #if-modified-since-caching )
50
+ - [ checkModifiedSince(date: string | Date)] ( #checkmodifiedsincedate-string--date )
51
+ - [ buildNotModifiedResponse()] ( #buildnotmodifiedresponse )
48
52
- [ Middleware helpers] ( #middleware-helpers )
49
- - [Apply To Context](#apply-to-context)
50
- - [Reroute](#reroute)
51
- - [Store Values](#store-values)
53
+ - [ Apply To Context] ( #apply-to-context )
54
+ - [ Reroute] ( #reroute )
55
+ - [ Store Values] ( #store-values )
52
56
- [ PJAX(road: * Road* , containerElement: * DomElement* , window: * Window* )] ( #pjaxroad-road-containerelement-domelement-window-window )
53
- - [PJAX.register()](#pjaxregister)
54
- - [PJAX.registerAdditionalElement(element: *HTMLAnchorElement*)](#pjaxregisteradditionalelementelement-htmlanchorelement)
55
- - [PJAX Link Format](#pjax-link-format)
56
- - [PJAX Form Format](#pjax-form-format)
57
- - [PJAX Page titles](#pjax-page-titles)
58
- - [PJAX Page Title Example](#pjax-page-title-example)
57
+ - [ PJAX.register()] ( #pjaxregister )
58
+ - [ PJAX.registerAdditionalElement(element: * HTMLAnchorElement* )] ( #pjaxregisteradditionalelementelement-htmlanchorelement )
59
+ - [ PJAX Link Format] ( #pjax-link-format )
60
+ - [ PJAX Form Format] ( #pjax-form-format )
61
+ - [ PJAX Page titles] ( #pjax-page-titles )
62
+ - [ PJAX Page Title Example] ( #pjax-page-title-example )
59
63
- [ Isomorphic PJAX tips] ( #isomorphic-pjax-tips )
60
64
- [ FAQ] ( #faq )
61
65
@@ -143,10 +147,10 @@ Building a project with roads is very straightforward.
143
147
});
144
148
` ` `
145
149
146
- - You can also use browserify to compile everything for use in the browser . Check out the file example / ts / build . ts for more details .
150
+ - You can also use a bundler ( like esbuild , rollup or webpack ) to compile everything for use in the browser . Check out the file example / ts / package . json for more details .
147
151
148
152
149
- Now that you can interact with your ROad , continue reading the docs below for more information on [routers ](#simplerouter ), [error handling ](#roadusefn - function ), [PJAX support](#pjaxroad -road ) and more!
153
+ Now that you can interact with your Road , continue reading the docs below for more information on [routers ](#simplerouter ), [error handling ](#roadusefn - function ), [PJAX support](#pjaxroad -road ) and more!
150
154
151
155
152
156
@@ -874,7 +878,7 @@ There's a very easy pattern to follow to ensure sharing client and server code w
874
878
875
879
1. Any route that is unsafe to be run in the browser should be kept in separate files from the rest.
876
880
2. Create two initalization scripts. One for starting the server, and one that will be compiled and loaded in the browser.
877
- 3. Compile the browser script to be run in the browser. Currently I recommend Browserify , and that's how the typescript example works.
881
+ 3. Compile the browser script to be run in the browser. Currently I recommend esbuild , and that's how the typescript example works.
878
882
4. Load the browser script on any server side page that should enable PJAX.
879
883
880
884
# FAQ
0 commit comments