-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app-express): bump deps. Full test harness. organize main
- Loading branch information
1 parent
0401495
commit f93e778
Showing
6 changed files
with
154 additions
and
93 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,6 +14,6 @@ export { | |
readableStreamFromIterable, | ||
readableStreamFromReader, | ||
} from 'https://deno.land/[email protected]/streams/mod.ts' | ||
export { contentType as getMimeType } from 'https://deno.land/std@0.207.0/media_types/mod.ts' | ||
export { contentType as getMimeType } from 'https://deno.land/std@0.208.0/media_types/mod.ts' | ||
|
||
export { isHyperErr } from 'https://raw.githubusercontent.com/hyper63/hyper/hyper-utils%40v0.1.2/packages/utils/mod.js' |
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,15 +1,66 @@ | ||
// Load .env | ||
import 'https://deno.land/std@0.207.0/dotenv/load.ts' | ||
import 'https://deno.land/std@0.208.0/dotenv/load.ts' | ||
|
||
import { default as core } from 'https://raw.githubusercontent.com/hyper63/hyper/hyper%40v4.3.1/packages/core/mod.ts' | ||
import namespacedS3 from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-namespaced-s3/v3.0.0/mod.js' | ||
import { join } from 'https://deno.land/[email protected]/path/mod.ts' | ||
|
||
import { default as core } from 'https://raw.githubusercontent.com/hyper63/hyper/hyper%40v4.3.2/packages/core/mod.ts' | ||
|
||
import { default as sqlite } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-sqlite/v2.0.12/mod.js' | ||
import { default as fs } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-fs/v3.0.2/mod.js' | ||
import { default as minisearch } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-minisearch/v2.1.4/mod.js' | ||
import { default as mongodb } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-mongodb/v3.3.0/mod.ts' | ||
import { default as queue } from 'https://raw.githubusercontent.com/hyper63/hyper-adapter-queue/v0.3.1/mod.js' | ||
|
||
import app from './mod.ts' | ||
|
||
const hyperConfig = { | ||
app, | ||
adapters: [{ port: 'storage' as const, plugins: [namespacedS3('express-harness')] }], | ||
middleware: [], | ||
async function mkdir(DIR: string) { | ||
try { | ||
return await Deno.mkdir(DIR, { recursive: true }) | ||
} catch (err) { | ||
if (err instanceof Deno.errors.AlreadyExists) { | ||
// already exists so return | ||
return true | ||
} else { | ||
// unexpected error, maybe permissions, pass it along | ||
throw err | ||
} | ||
} | ||
} | ||
|
||
async function main() { | ||
const DIR = join('.', '__hyper__') | ||
|
||
await mkdir(DIR) | ||
|
||
const hyperConfig = { | ||
app, | ||
adapters: [ | ||
{ | ||
port: 'data' as const, | ||
plugins: [mongodb({ dir: DIR, dirVersion: '7.0.4' })], | ||
}, | ||
{ | ||
port: 'cache' as const, | ||
plugins: [sqlite({ dir: DIR })], | ||
}, | ||
{ | ||
port: 'storage' as const, | ||
plugins: [fs({ dir: DIR })], | ||
}, | ||
{ | ||
port: 'search' as const, | ||
plugins: [minisearch({ dir: DIR })], | ||
}, | ||
{ | ||
port: 'queue' as const, | ||
// @ts-ignore name is actually optional, so this error can be ignored. TODO: update the types | ||
plugins: [queue({ dir: DIR })], | ||
}, | ||
], | ||
middleware: [], | ||
} | ||
|
||
return core(hyperConfig) | ||
} | ||
|
||
core(hyperConfig) | ||
main() |
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