Skip to content

Commit 2fce876

Browse files
committed
remove the word basic from basic router
1 parent 50b96f0 commit 2fce876

File tree

17 files changed

+58
-165
lines changed

17 files changed

+58
-165
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Roads is a simple web framework. It's similar to Express.js, but has some very i
4242
- [Parsing request bodies](#parsing-request-bodies)
4343
- [Parse Body Context](#parse-body-context)
4444
- [Remove trailing slash](#remove-trailing-slash)
45-
- [Basic router](#basic-router)
45+
- [Router](#router)
4646
- [applyMiddleware(road: *Road*)](#applymiddlewareroad-road)
4747
- [addRoute(method: *string*, path: *string*, fn: *function*)](#addroutemethod-string-path-string-fn-function)
4848
- [addRouteFile(filePath: *string*, prefix?: *string*)](#addroutefilefilepath-string-prefix-string)
@@ -547,8 +547,8 @@ var road = new Road();
547547
road.use(RemoveTrailingSlashMiddleware.middleware);
548548
```
549549
550-
## Basic router
551-
This is a basic router middleware for roads. It allows you to easily attach functionality to HTTP methods and paths.
550+
## Router
551+
This is a Router middleware for roads. It allows you to easily attach functionality to HTTP methods and paths.
552552
553553
Here's how you use it.
554554

example/ts/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
public/*
1+
public/*
2+
types/*

example/ts/src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* This file is an example of using roads router in the client
77
*/
88

9-
import { Road, RoadsPJAX, ParseBodyMiddleware, BasicRouterMiddleware, CookieMiddleware, Request } from 'roads';
9+
import { Road, RoadsPJAX, ParseBodyMiddleware, RouterMiddleware, CookieMiddleware, Request } from 'roads';
1010
import applyPublicRotues from './routes/applyPublicRoutes';
1111
import emptyTo404 from './middleware/emptyTo404';
1212

@@ -25,7 +25,7 @@ road.use(ParseBodyMiddleware.middleware);
2525
road.use(CookieMiddleware.buildClientMiddleware(document));
2626
pjax.register();
2727
pjax.registerAdditionalElement(document.getElementById('home') as HTMLAnchorElement);
28-
const router = new BasicRouterMiddleware.BasicRouter(road);
28+
const router = new RouterMiddleware.Router(road);
2929
applyPublicRotues(router);
3030

3131
const testRequest = new Request(false, 'localhost', 8081);

example/ts/src/routes/applyPrivateRoutes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import * as fs from 'fs';
1010
import { CookieContext } from 'roads/types/middleware/cookieMiddleware';
1111
import { StoreValsContext } from 'roads/types/middleware/storeVals';
12-
import { BasicRouterMiddleware, Response } from 'roads';
12+
import { RouterMiddleware, Response } from 'roads';
1313
const TITLE_KEY = 'page-title';
1414

1515
/**
@@ -19,7 +19,7 @@ const TITLE_KEY = 'page-title';
1919
*
2020
* @param {SimpleRouter} router - The router that the routes will be added to
2121
*/
22-
export default function applyPrivateRotues(router: BasicRouterMiddleware.BasicRouter<StoreValsContext>): void {
22+
export default function applyPrivateRotues(router: RouterMiddleware.Router<StoreValsContext>): void {
2323
router.addRoute<CookieContext>('GET', '/private', async function () {
2424
this.storeVal(TITLE_KEY, 'Private Resource');
2525
this.setCookie('private_cookie', 'foo', {

example/ts/src/routes/applyPublicRoutes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* This file is an example of how to assign some public routes to a roads server
77
*/
88

9-
import { Response, BasicRouterMiddleware } from 'roads';
9+
import { Response, RouterMiddleware } from 'roads';
1010
const TITLE_KEY = 'page-title';
1111

1212
import { ParseBodyContext } from 'roads/types/middleware/parseBody';
@@ -24,7 +24,7 @@ interface ExampleRequestBody {
2424
*
2525
* @param {SimpleRouter} router - The router that the routes will be added to
2626
*/
27-
export default function applyPublicRotues(router: BasicRouterMiddleware.BasicRouter<StoreValsContext>): void {
27+
export default function applyPublicRotues(router: RouterMiddleware.Router<StoreValsContext>): void {
2828
router.addRoute('GET', '/', async function () {
2929
this.storeVal(TITLE_KEY, 'Root Resource');
3030

example/ts/src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { Road, Response, RemoveTrailingSlashMiddleware, CookieMiddleware,
10-
StoreValsMiddleware, ParseBodyMiddleware, BasicRouterMiddleware } from 'roads';
10+
StoreValsMiddleware, ParseBodyMiddleware, RouterMiddleware } from 'roads';
1111

1212
import { Server } from 'roads-server';
1313
import addLayout from './middleware/addLayout';
@@ -28,7 +28,7 @@ road.use(StoreValsMiddleware.middleware);
2828
road.use(addLayout);
2929
road.use(ParseBodyMiddleware.middleware);
3030

31-
const router = new BasicRouterMiddleware.BasicRouter(road);
31+
const router = new RouterMiddleware.Router(road);
3232
applyPublicRotues(router);
3333
applyPrivateRoutes(router);
3434
road.use(emptyTo404);

example/ts/types/build.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/ts/types/buildClient.d.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

example/ts/types/client.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

example/ts/types/middleware/addLayout.d.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)