first commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
PORT = 6320
|
||||||
|
MONGO_URL = "mongodb://digifi:digifi@10.10.10.48:27017"
|
||||||
|
|
||||||
|
VERIFY_ME_ENDPOINT = "https://vapi.verifyme.ng/v1/verifications/identities/bvn"
|
||||||
|
VERIFY_ME_PUBLIC_KEY = "pk_live_9f4c2642862cb0190d3b72ca94579b2670fd797a124"
|
||||||
|
VERIFY_ME_PUBLIC_TEST_SECRET = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE1MjgzNywiZW52IjoidGVzdCIsImlhdCI6MTY1ODgyMzY0OH0.PszalhCuvCv6Y7kK41o3LuJh_R9kIlodbtWSi8HoFnI"
|
||||||
|
VERIFY_ME_PUBLIC_LIVE_SECRET = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjE1MjgzNywiZW52IjoibGl2ZSIsImlhdCI6MTY1ODgyMzY0OH0.jGwa1S6BKr14-QC_0isfVdmhjo_geC1EgyqIh65fhY4"
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
|
||||||
|
node_modules/*
|
||||||
|
|
||||||
+123
@@ -0,0 +1,123 @@
|
|||||||
|
#FROM node:erbium
|
||||||
|
|
||||||
|
FROM alpine:3.18
|
||||||
|
|
||||||
|
ENV NODE_VERSION 22.1.0
|
||||||
|
|
||||||
|
RUN addgroup -g 1000 node \
|
||||||
|
&& adduser -u 1000 -G node -s /bin/sh -D node \
|
||||||
|
&& apk add --no-cache \
|
||||||
|
libstdc++ \
|
||||||
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
curl \
|
||||||
|
&& ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \
|
||||||
|
&& case "${alpineArch##*-}" in \
|
||||||
|
x86_64) ARCH='x64' CHECKSUM="087edf483f8bf94acfd41bdada76a296d0673f7739ebfe1179971c90f34d3a95" OPENSSL_ARCH=linux-x86_64;; \
|
||||||
|
x86) OPENSSL_ARCH=linux-elf;; \
|
||||||
|
aarch64) OPENSSL_ARCH=linux-aarch64;; \
|
||||||
|
arm*) OPENSSL_ARCH=linux-armv4;; \
|
||||||
|
ppc64le) OPENSSL_ARCH=linux-ppc64le;; \
|
||||||
|
s390x) OPENSSL_ARCH=linux-s390x;; \
|
||||||
|
*) ;; \
|
||||||
|
esac \
|
||||||
|
&& if [ -n "${CHECKSUM}" ]; then \
|
||||||
|
set -eu; \
|
||||||
|
curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \
|
||||||
|
echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \
|
||||||
|
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
|
||||||
|
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs; \
|
||||||
|
else \
|
||||||
|
echo "Building from source" \
|
||||||
|
# backup build
|
||||||
|
&& apk add --no-cache --virtual .build-deps-full \
|
||||||
|
binutils-gold \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
gnupg \
|
||||||
|
libgcc \
|
||||||
|
linux-headers \
|
||||||
|
make \
|
||||||
|
python3 \
|
||||||
|
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
# gpg keys listed at https://github.com/nodejs/node#release-keys
|
||||||
|
&& for key in \
|
||||||
|
4ED778F539E3634C779C87C6D7062848A1AB005C \
|
||||||
|
141F07595B7B3FFE74309A937405533BE57C7D57 \
|
||||||
|
74F12602B6F1C4E913FAA37AD3A89613643B6201 \
|
||||||
|
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \
|
||||||
|
61FC681DFB92A079F1685E77973F295594EC4689 \
|
||||||
|
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
|
||||||
|
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
||||||
|
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \
|
||||||
|
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \
|
||||||
|
108F52B48DB57BB0CC439B2997B01419BD92F80A \
|
||||||
|
A363A499291CBBC940DD62E41F10027AF002F8B0 \
|
||||||
|
CC68F5A3106FF448322E48ED27F5E38D5B0A215F \
|
||||||
|
; do \
|
||||||
|
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
|
||||||
|
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||||
|
done \
|
||||||
|
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
|
||||||
|
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
||||||
|
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
||||||
|
&& tar -xf "node-v$NODE_VERSION.tar.xz" \
|
||||||
|
&& cd "node-v$NODE_VERSION" \
|
||||||
|
&& ./configure \
|
||||||
|
&& make -j$(getconf _NPROCESSORS_ONLN) V= \
|
||||||
|
&& make install \
|
||||||
|
&& apk del .build-deps-full \
|
||||||
|
&& cd .. \
|
||||||
|
&& rm -Rf "node-v$NODE_VERSION" \
|
||||||
|
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
|
||||||
|
fi \
|
||||||
|
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \
|
||||||
|
# Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451
|
||||||
|
&& find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \
|
||||||
|
&& apk del .build-deps \
|
||||||
|
# smoke tests
|
||||||
|
&& node --version \
|
||||||
|
&& npm --version
|
||||||
|
|
||||||
|
ENV YARN_VERSION 1.22.19
|
||||||
|
|
||||||
|
RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar \
|
||||||
|
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150
|
||||||
|
&& export GNUPGHOME="$(mktemp -d)" \
|
||||||
|
&& for key in \
|
||||||
|
6A010C5166006599AA17F08146C2130DFD2497F5 \
|
||||||
|
; do \
|
||||||
|
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
|
||||||
|
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
|
||||||
|
done \
|
||||||
|
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
|
||||||
|
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
|
||||||
|
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
|
||||||
|
&& gpgconf --kill all \
|
||||||
|
&& rm -rf "$GNUPGHOME" \
|
||||||
|
&& mkdir -p /opt \
|
||||||
|
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
|
||||||
|
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
|
||||||
|
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
|
||||||
|
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
|
||||||
|
&& apk del .build-deps-yarn \
|
||||||
|
# smoke test
|
||||||
|
&& yarn --version \
|
||||||
|
&& rm -rf /tmp/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Create app directory
|
||||||
|
RUN mkdir -p /usr/src
|
||||||
|
WORKDIR /usr/src
|
||||||
|
|
||||||
|
# Install app dependencies
|
||||||
|
COPY package.json /usr/src/
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . /usr/src
|
||||||
|
|
||||||
|
CMD [ "npm", "start" ]
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import User from "../model/cardModel.js";
|
||||||
|
|
||||||
|
export const createCard = async (req,res)=>{
|
||||||
|
try {
|
||||||
|
const userData = new User(req.body);
|
||||||
|
const { email } = userData;
|
||||||
|
|
||||||
|
const userExist = await User.findOne({email});
|
||||||
|
if (userExist) {
|
||||||
|
return res.status(400).json({message: "User already exixt"});
|
||||||
|
}
|
||||||
|
const saveUser = await userData.save();
|
||||||
|
res.status(200).json(saveUser);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
res.status(500).json({error: `Internal Server error 002 ${error} ` });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const activateCard = async (req, res)=>{
|
||||||
|
try{
|
||||||
|
|
||||||
|
return res.json("Hello Worlds");
|
||||||
|
}catch(error){
|
||||||
|
res.status(500).json({error: "Internal Server error"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//C:\WORKS\PROJECTS\WRB\WrenchCore\WrenchStripeNode\controller\cardsController.js
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
wrench-stripe-micro:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./:/usr/src
|
||||||
|
- '/usr/src/node_modules'
|
||||||
|
ports:
|
||||||
|
- 6332:6320
|
||||||
|
# environment:
|
||||||
|
# - PORT=${WRENCHJOB_PORT}
|
||||||
|
# - POSTGRE_URL=${WRENCHJOB_POSTGRE_URL}
|
||||||
|
volumes:
|
||||||
|
src:
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import express from "express"
|
||||||
|
import mongoose from "mongoose"
|
||||||
|
import bodyParser from "body-parser"
|
||||||
|
import dotenv from "dotenv"
|
||||||
|
import card_route from "./routes/cardRoute.js"
|
||||||
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
// Enable parsing of URL-encoded data on all routes:
|
||||||
|
app.use(express.urlencoded({
|
||||||
|
extended: false, // Whether to use algorithm that can handle non-flat data strutures
|
||||||
|
limit: 10000, // Limit payload size in bytes
|
||||||
|
parameterLimit: 2, // Limit number of form items on payload
|
||||||
|
}));
|
||||||
|
|
||||||
|
//app.use(bodyParser.json());
|
||||||
|
dotenv.config();
|
||||||
|
const PORT = process.env.PORT || 5000;
|
||||||
|
const MONGOURL = process.env.MONGO_URL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mongoose.connect(MONGOURL).then(()=>{
|
||||||
|
console.log("Data connected");
|
||||||
|
app.listen(PORT,()=>{
|
||||||
|
console.log(`Server on ${PORT}`);
|
||||||
|
})
|
||||||
|
}).catch((error)=>{
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
app.use("/api/cards", card_route);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Generated
+1403
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "Wrench-Stripe",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "WrenchBoard Stripe",
|
||||||
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node index.js",
|
||||||
|
"start:dev": "nodemon index.js"
|
||||||
|
},
|
||||||
|
"author": "ChiefSoft Works",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@stripe/stripe-js": "^4.0.0",
|
||||||
|
"axios": "^1.6.8",
|
||||||
|
"body-parser": "^1.20.2",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"express": "^4.19.2",
|
||||||
|
"mongoose": "^8.3.3",
|
||||||
|
"nodemailer": "^6.9.13"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^3.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import express from "express"
|
||||||
|
import { activateCard,createCard } from "../controller/cardsController.js"
|
||||||
|
|
||||||
|
const card_route = express.Router();
|
||||||
|
route.post("/create",createCard);
|
||||||
|
route.get("/activate", activateCard)
|
||||||
|
|
||||||
|
export default card_route;
|
||||||
Reference in New Issue
Block a user