-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from sejori/router-rework
Router rework
- Loading branch information
Showing
38 changed files
with
557 additions
and
720 deletions.
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
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,20 +1,20 @@ | ||
import { Server, logger } from "https://deno.land/x/peko/mod.ts" | ||
import { Router, logger } from "../../mod.ts" //"https://deno.land/x/peko/mod.ts" | ||
import pages from "./routes/pages.ts" | ||
import assets from "./routes/assets.ts" | ||
import APIs from "./routes/APIs.ts" | ||
|
||
// initialize server | ||
const server = new Server() | ||
server.use(logger(console.log)) | ||
const router = new Router() | ||
router.use(logger(console.log)) | ||
|
||
// SSR'ed app page routes | ||
server.addRoutes(pages) | ||
router.addRoutes(pages) | ||
|
||
// Static assets | ||
server.addRoutes(assets) | ||
router.addRoutes(assets) | ||
|
||
// Custom API functions | ||
server.addRoutes(APIs) | ||
router.addRoutes(APIs) | ||
|
||
// Start Peko server :^) | ||
server.listen() | ||
// Start Deno server with Peko router :^) | ||
Deno.serve((req) => router.requestHandler(req)) |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ import { | |
staticHandler, | ||
cacher, | ||
ResponseCache | ||
} from "https://deno.land/x/peko/mod.ts" | ||
} from "../../../mod.ts" | ||
|
||
import { recursiveReaddir } from "https://deno.land/x/[email protected]/mod.ts" | ||
import { fromFileUrl } from "https://deno.land/[email protected]/path/mod.ts" | ||
|
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
Oops, something went wrong.