Skip to content

Commit 459994d

Browse files
authored
Merge pull request #101 from Dashron/8.0
8.0-alpha 1
2 parents 3568477 + 1c021a2 commit 459994d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+7247
-12784
lines changed

.github/workflows/nodejs.yml

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
strategy:
1110
matrix:
1211
# 8.x and lower not supported due to lack of URL object
1312
# 10.x not supported with the current version of EJS. If you need it, it will probably run fine
14-
node-version: [14.x, 16.x, 18.x, 19.x]
13+
# 14.x and 15.x are not supported by vitest
14+
# 19.x and up the request UA is `undici` and affected the tests
15+
node-version: [18.x, 19.x, 20.x, 21.x, 22.x]
1516

1617
steps:
17-
- uses: actions/checkout@v1
18-
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/setup-node@v1
20-
with:
21-
node-version: ${{ matrix.node-version }}
22-
- name: npm install, build, and test
23-
run: |
24-
npm install
25-
npm run build --if-present
26-
npm test
27-
env:
28-
CI: true
18+
- uses: actions/checkout@v1
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- name: npm install, build, and test
24+
run: |
25+
npm install
26+
npm run build --if-present
27+
npm test
28+
env:
29+
CI: true

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
.vscode
3-
dist
3+
dist
4+
types

README.md

+44-40
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,53 @@ Roads is a simple web framework. It's similar to Express.js, but has some very i
1313
![Build status](https://travis-ci.org/Dashron/roads.svg?branch=master)
1414

1515
# 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)
1620
- [Getting Started](#getting-started)
1721
- [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)
2529
- [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)
3034
- [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)
4852
- [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)
5256
- [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)
5963
- [Isomorphic PJAX tips](#isomorphic-pjax-tips)
6064
- [FAQ](#faq)
6165

@@ -143,10 +147,10 @@ Building a project with roads is very straightforward.
143147
});
144148
```
145149

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.
147151

148152

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!
150154

151155

152156

@@ -874,7 +878,7 @@ There's a very easy pattern to follow to ensure sharing client and server code w
874878
875879
1. Any route that is unsafe to be run in the browser should be kept in separate files from the rest.
876880
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.
878882
4. Load the browser script on any server side page that should enable PJAX.
879883
880884
# FAQ

example/ts/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public/*

0 commit comments

Comments
 (0)