forked from freeCodeCamp/freeCodeCamp
-
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.
feat(api): example middleware (freeCodeCamp#48434)
* feat(api): add middleware example * feat(api): add `@fastify/middie`, reorder for alphabetness * [skip-ci] [skip ci]
- Loading branch information
1 parent
6d46f61
commit f7644be
Showing
5 changed files
with
263 additions
and
393 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
import { NextFunction } from '../utils'; | ||
|
||
export async function auth0Verify() { | ||
// Verify user authorization code with Auth0 | ||
} | ||
|
||
export function testMiddleware( | ||
req: Request, | ||
_res: Response, | ||
next: NextFunction | ||
) { | ||
// | ||
console.log('Test middleware running'); | ||
console.log(req.headers); | ||
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,31 +1,40 @@ | ||
{ | ||
"name": "@freecodecamp/api", | ||
"version": "0.0.1", | ||
"author": "freeCodeCamp <team@freecodecamp.org>", | ||
"bugs": { | ||
"url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" | ||
}, | ||
"dependencies": { | ||
"@fastify/middie": "8.0.0", | ||
"@fastify/mongodb": "6.1.0", | ||
"fastify": "4.9.2", | ||
"fastify-plugin": "4.3.0" | ||
}, | ||
"description": "The freeCodeCamp.org open-source codebase and curriculum", | ||
"license": "BSD-3-Clause", | ||
"private": true, | ||
"engines": { | ||
"node": ">=18", | ||
"npm": ">=8" | ||
}, | ||
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", | ||
"license": "BSD-3-Clause", | ||
"main": "none", | ||
"name": "@freecodecamp/api", | ||
"nodemonConfig": { | ||
"env": { | ||
"NODE_ENV": "development" | ||
}, | ||
"ignore": [ | ||
"**/*.js" | ||
] | ||
}, | ||
"private": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/freeCodeCamp/freeCodeCamp.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" | ||
}, | ||
"homepage": "https://github.com/freeCodeCamp/freeCodeCamp#readme", | ||
"author": "freeCodeCamp <team@freecodecamp.org>", | ||
"main": "none", | ||
"scripts": { | ||
"build": "tsc index.ts", | ||
"start": "NODE_ENV=production node index.js", | ||
"develop": "NODE_ENV=development nodemon index.ts" | ||
"develop": "nodemon index.ts" | ||
}, | ||
"dependencies": { | ||
"@fastify/mongodb": "6.1.0", | ||
"fastify": "4.9.2", | ||
"fastify-plugin": "4.3.0" | ||
} | ||
"version": "0.0.1" | ||
} |
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.