View user.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
process.env.NODE_ENV = "test"; | |
const app = require("../app"); | |
const chai = require("chai"); | |
const request = require("supertest"); | |
const expect = chai.expect; | |
const mongoose = require("mongoose"); | |
process.env.TEST_SUITE = "testdb"; | |
beforeEach(async () => { | |
if (mongoose.connection.readyState === 0) { |
View otpverify.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
const otpGenerator = require("otp-generator"); | |
const crypto = require("crypto"); | |
const key = "verysecretkey"; // Key for cryptograpy. Keep it secret | |
function createNewOTP(phone){ | |
// Generate a 6 digit numeric OTP | |
const otp = otpGenerator.generate(6, {alphabets: false, upperCase: false, specialChars: false}); | |
const ttl = 5 * 60 * 1000; //5 Minutes in miliseconds | |
const expires = Date.now() + ttl; //timestamp to 5 minutes in the future | |
const data = `${phone}.${otp}.${expires}`; // phone.otp.expiry_timestamp |
View query.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
/** | |
* Query blog posts by user -> paginated results and a total count. | |
* @param userId {ObjectId} ID of user to retrieve blog posts for | |
* @param startRow {Number} First row to return in results | |
* @param endRow {Number} Last row to return in results | |
* @param [filter] {Object} Optional extra matching query object | |
* @param [sort] {Object} Optional sort query object | |
* @returns {Object} Object -> `{ rows, count }` | |
*/ | |
function queryBlogPostsByUser (userId, startRow, endRow, filter = {}, sort = false) { |
View server-starter.bat
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
@echo 'starting mongo db service' | |
start mongod | |
cd /d F:\1.Projects\templates\rest-api-server | |
@echo 'starting rest api server at port: 3100' | |
start npm run dev | |
cd /d F:\1.Projects\tempaltes\pwa\mealmanager-pwa | |
@echo 'starting meal manager pwa' | |
start npm run serve |
View default.conf
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /your/root/path; | |
index index.html; | |
server_name you.server.com; |
View XLSXchooseSheet.html
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
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script src="libraries/PapaParse-4.1.2/papaparse.min.js"></script> | |
<script src="libraries/xlsx/xlsx-0.8.0.core.min.js"></script> | |
<script src="libraries/bootstrap/js/bootstrap-4.0.0.min.js"></script> | |
<link rel="stylesheet" href="libraries/bootstrap/css/bootstrap-4.0.0.min.css"> | |
<script src="libraries/bootstrap.file-input.js"></script> |
View app.vue
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
<template> | |
<div> | |
<file-input v-model="filename" @formData="formData"></file-input> | |
<v-btn @click.native="uploadFiles"></v-btn> | |
</div> | |
</template> | |
<script> | |
import fileInput from './file-input.vue' |