-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb92f0e
commit 57295d7
Showing
58 changed files
with
505 additions
and
123 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 |
---|---|---|
|
@@ -14,5 +14,4 @@ export const assembleDeps = async (): Promise<Deps> => { | |
config, | ||
fetch: { fetch }, | ||
}); | ||
} | ||
|
||
}; |
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,3 +1,3 @@ | ||
export { Handlers } from './handlers'; | ||
export { Middleware } from './middleware'; | ||
export { connectRoutes } from './routes'; | ||
export { connectRoutes } from './routes'; |
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,8 +1,8 @@ | ||
import type { Request, Response, NextFunction } from "express"; | ||
import type { Request, Response, NextFunction } from 'express'; | ||
|
||
export const Middleware = { | ||
cors: (req: Request, res: Response, next: NextFunction) => { | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
next(); | ||
} | ||
} | ||
}, | ||
}; |
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,18 +1,18 @@ | ||
import { fallthroughHandler, loggingMiddleware } from '@monorepo/shared-be'; | ||
import { Middleware } from './middleware'; | ||
import { Handlers } from './handlers'; | ||
import { Deps } from "../types"; | ||
import { Deps } from '../types'; | ||
|
||
export const connectRoutes = async (deps: Deps) => { | ||
const { app } = deps; | ||
|
||
app.use(loggingMiddleware(`my-microservice`)); | ||
app.use(Middleware.cors); | ||
|
||
app.get('/', await Handlers["GET /"]()); | ||
app.get('/proxy', await Handlers["GET /proxy"](deps)); | ||
app.get('/', await Handlers['GET /']()); | ||
app.get('/proxy', await Handlers['GET /proxy'](deps)); | ||
|
||
app.all('*', fallthroughHandler); | ||
|
||
app.use(await Handlers.errors()); | ||
} | ||
}; |
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,16 +1,15 @@ | ||
import { Fetch } from "@monorepo/shared-types"; | ||
import type { Application } from "express"; | ||
import { Fetch } from '@monorepo/shared-types'; | ||
import type { Application } from 'express'; | ||
|
||
export type Config = { | ||
port: number; | ||
other: { | ||
host: string; | ||
}; | ||
} | ||
}; | ||
|
||
export type Deps = Readonly<{ | ||
app: Application; | ||
config: Config; | ||
fetch: Fetch; | ||
}>; | ||
|
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const path = require("path"); | ||
const common = require('../../.jest/common'); | ||
|
||
module.exports = { | ||
...common, | ||
displayName: path.basename(__dirname), | ||
} |
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.