-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Microservice for handling Auth0 actions requests (#264)
* feat: Microservice for handling Auth0 actions requests (#263) * feat(ci): Update github actions for auth0-actions microservice --------- Co-authored-by: Abhinav M M <[email protected]>
- Loading branch information
1 parent
fa5861a
commit 82e8917
Showing
13 changed files
with
264 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
build |
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,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['custom'], | ||
}; |
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,22 @@ | ||
FROM node:16-alpine AS builder | ||
RUN apk update && apk add --no-cache libc6-compat | ||
RUN corepack enable && corepack prepare [email protected] --activate | ||
|
||
WORKDIR /app | ||
|
||
RUN npm install turbo | ||
|
||
COPY ../../. . | ||
|
||
RUN pnpm install | ||
|
||
RUN pnpm run build --filter=core-auth0-actions... | ||
|
||
FROM node:18-alpine | ||
|
||
COPY --from=builder /app/apps/core-auth0-actions/dist . | ||
COPY --from=builder /app/node_modules/.pnpm/@prisma+client*/node_modules/.prisma/client/*.node . | ||
|
||
ENV PORT=80 | ||
|
||
CMD ["app.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "core-auth0-actions", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "npm run clean & webpack --config webpack.config.js", | ||
"clean": "rimraf dist & rimraf build", | ||
"dev": "concurrently \"npx tsc --watch\" \"nodemon -q build/index.js\"", | ||
"start": "node dist/app.js", | ||
"lint": "eslint --ext .ts src" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"dotenv": "^16.0.3", | ||
"express": "^4.18.2", | ||
"body-parser": "^1.20.2", | ||
"cors": "^2.8.5", | ||
"database": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.5", | ||
"@types/express": "^4.17.17", | ||
"@types/node": "^20.10.5", | ||
"@types/pg": "^8.10.1", | ||
"@typescript-eslint/eslint-plugin": "^6.7.3", | ||
"concurrently": "^8.0.1", | ||
"eslint": "^8.56.0", | ||
"eslint-config-custom": "*", | ||
"eslint-config-standard-with-typescript": "^43.0.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-n": "^16.5.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"nodemon": "^3.0.1", | ||
"prettier": "3.1.1", | ||
"rimraf": "^5.0.1", | ||
"ts-loader": "^9.5.1", | ||
"tsconfig": "workspace:*", | ||
"typescript": "^5.0.4", | ||
"webpack": "^5.89.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |
File renamed without changes.
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,39 @@ | ||
import express, { Request, Response } from 'express'; | ||
import dotenv from 'dotenv'; | ||
import { addNewUserToDatabaseOnRegister } from './controllers/newuser'; | ||
|
||
const bodyParser = require('body-parser'); | ||
const cors = require('cors'); | ||
dotenv.config(); | ||
|
||
const port = process.env.PORT || 80; | ||
|
||
const app = express(); | ||
app.use( | ||
cors({ | ||
origin: '*', | ||
}), | ||
); | ||
app.use(bodyParser.json()); | ||
|
||
app.get('/health', (req: Request, res: Response) => { | ||
const healthcheck: any = { | ||
resource: 'Techno Auth0 Actions Server', | ||
uptime: process.uptime(), | ||
responseTime: process.hrtime(), | ||
message: 'OK', | ||
timestamp: Date.now(), | ||
}; | ||
try { | ||
res.send(healthcheck); | ||
} catch (error) { | ||
healthcheck.message = error; | ||
res.status(503).send(); | ||
} | ||
}); | ||
|
||
app.post('/api/auth/newuser', addNewUserToDatabaseOnRegister); | ||
|
||
app.listen(port, () => { | ||
console.log(`Server is running at http://localhost:${port}`); | ||
}); |
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 { PrismaClient } = require('database'); | ||
|
||
const prisma = new PrismaClient({ | ||
datasourceUrl: process.env.DATABASE_URL, | ||
}); | ||
|
||
export default prisma; |
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,9 @@ | ||
{ | ||
"extends": "tsconfig/tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./build/", | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules"] | ||
} |
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,23 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
target: 'node', | ||
entry: './src/index.ts', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'app.js', | ||
}, | ||
mode: 'production', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.tsx', '.ts', '.js'], | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.