Skip to content

Instantly share code, notes, and snippets.

Avatar
🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>

Ilori stephen harryWonder

🇳🇬
I am that software developer that you cannot sideline. I am <harrywonder/>
View GitHub Profile
View Routes.js
const Middleware = require('../middleware/JwtMiddleware');
const Newsletter = require('../controllers/app/Newsletter');
const Welcome = require('../controllers/Welcome');
const Signup = require('../controllers/auth/Signup');
const Login = require('../controllers/auth/Login');
/**
* All the API endpoint or routes to mars is loaded here. You can load in routes from anywhere but it's best that you load them in from the controllers.
*
* @author Ilori Stephen <stephenilori458@gmail.com>
View Signup.js
const Jwt = require('jsonwebtoken');
const CryptoJs = require('crypto-js');
const Controller = require('../Controller');
const UserModel = require('../../models/Users');
/* Validators */
const Validators = require('../../validators/Auth')
class Signup extends Controller {
constructor() { super(); }
View Login.js
const Jwt = require('jsonwebtoken');
const Controller = require('../Controller');
const UserModel = require('../../models/Users');
/* Validators */
const Validators = require('../../validators/Auth')
class Login extends Controller {
constructor() { super(); }
View docker-compose.yml
version: "3.9"
services:
martian_mongo_flavour:
build: .
env_file:
- .env.testing
links:
- martian_mongo_db
- martian_redis_db
View nginx.conf
events { worker_connections 1024; }
http {
#upstream servers
upstream martian_servers {
server martian_martian_mongo_flavour_1:4400;
server martian_martian_mongo_flavour_2:4400;
server martian_martian_mongo_flavour_3:4400;
}
View nginx.Dockerfile
FROM nginx:1.19.8-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
@harryWonder
harryWonder / Dockerfile
Created Jun 10, 2021
LD NodeJS & Nginx
View Dockerfile
FROM node:15.12.0-alpine3.10
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
@harryWonder
harryWonder / Login.js
Created Jun 10, 2021
LD NodeJS & Nginx
View Login.js
const Jwt = require('jsonwebtoken');
const Controller = require('../Controller');
const UserModel = require('../../models/Users');
/* Validators */
const Validators = require('../../validators/Auth')
class Login extends Controller {
constructor() { super(); }
View Newsletter.js
const Controller = require('../Controller');
const Validators = require('../../validators/Validator');
const NewsletterModel = require('../../models/Newsletters');
const Mail = require('../../mail/Mail');
class Newsletter extends Controller {
constructor() { super(); }
@harryWonder
harryWonder / Auth.js
Created Jun 10, 2021
LD NodeJS & Nginx
View Auth.js
const CryptoJs = require('crypto-js');
const BaseValidator = require('./Validator');
class Auth extends BaseValidator {
constructor() { super(); }
async login(Payload, Model) {
const Response = { status: false, errors: {} }
try {