Skip to content

Instantly share code, notes, and snippets.

View hellotunmbi's full-sized avatar

Olutunmbi Banto hellotunmbi

View GitHub Profile
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/<name-of-app>'));
app.get('/*', function(req,res) {
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-feed
labels:
app: backend-feed
spec:
replicas: 2
selector:
matchLabels:
@hellotunmbi
hellotunmbi / parser.js
Created September 17, 2022 18:20 — forked from lordgape/parser.js
A node utility class to convert xml to json and vice versa. Depends on xml2js and jsontoxml node package
const jsonxml = require("jsontoxml");
const parseString = require("xml2js").parseString;
const { promisify } = require("util");
const promisfiedParseString = promisify(parseString);
module.exports = class Parser {
static parseJSONBodyToXML(jsonArgument) {
return jsonxml(jsonArgument, { html: true });
}
@hellotunmbi
hellotunmbi / 1.mongodb-aws-setup-guide.md
Created July 11, 2022 03:31 — forked from calvinh8/1.mongodb-aws-setup-guide.md
MongoDB Setup Guide for AWS EC2 Instances with Auth Enabled

MongoDB AWS EC2 Setup Guide

You can see my latest update in my blog here https://medium.com/@calvin.hsieh/steps-to-install-mongodb-on-aws-ec2-instance-62db66981218

Credits:

Big thanks to Elad Nava and Shane Rainville for writing the above articles that allow me to conduct this guide. If by all means that I violated original post's copyright, please contact me.

@hellotunmbi
hellotunmbi / gist:68c7735443c92034b3961f78eba7c3e4
Last active June 15, 2022 12:12
add-engine-for-ng-deployment-to-heroku
"engines": {
"node": "16.15.0",
"npm": "8.5.5"
}
@hellotunmbi
hellotunmbi / nigeria-states-lga.txt
Created December 23, 2021 21:05 — forked from segebee/gist:7dde9de8e70a207e6e19
Nigeria States and Local Government Areas JSON - codingsavvy.com
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung
# activate URL rewriting
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
// movies.spec.js
...
// Testing the POST /movies endpoint
it("tests the post new movies endpoint and returns as success message", async () => {
const response = await supertest(app).post('/movies').send({
title: 'New Movie',
synopsis: 'Synopsis of the new movie',
rating: 'PG'
//movies.spec.js
const supertest = require('supertest');
const app = require('../server');
describe("Testing the movies API", () => {
it("tests the base route and returns true for status", async () => {
const response = await supertest(app).get('/');