Skip to content

Instantly share code, notes, and snippets.

@lobot
lobot / route-web-js
Created January 5, 2022 22:56
sending-check-route-web-js
const express = require("express");
const router = express.Router();
// Controller Import
const checkController = require("../controllers/check.controller");
// Route Declaration
router.route("/")
.get(checkController.createCheck)
.post(checkController.createCheckPost);
@lobot
lobot / models-checks-js
Created January 5, 2022 22:56
sending-check-models-checks-js
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
// Check schema definition
const CheckSchema = new Schema(
{
checkId: { type: String, required: true },
description: { type: String, default: null },
to: { type: Schema.Types.Mixed, default: null },
from: { type: Schema.Types.Mixed, default: null },
@lobot
lobot / index-js
Created January 5, 2022 22:55
sending-check-index-js
import express from "express";
import mongoose from "mongoose";
import cors from "cors";
import path from "path";
const app = express();
const PORT = 5000;
const dbConnectionString = "mongodb://localhost:27017/lobchecks"
app.use(express.urlencoded({ extended: true }));
app.use(express.text());
@lobot
lobot / contents-of-babelrc
Created January 5, 2022 22:53
sending-check-contents-of-babelrc
{
"presets": [
"@babel/preset-env"
]
}
@lobot
lobot / create-babel-file
Created January 5, 2022 22:52
sending-check-create-babel-file
touch .babelrc
@lobot
lobot / final-package-json
Created January 5, 2022 22:52
sending-check-final-package-json
{
"name": "lobchecks",
"version": "1.0.0",
"description": "A sample node project, demonstrating the use of Lob checks.",
"main": "./src/index.js",
"scripts": {
"start-dev": "babel-node ./src/index.js",
"dev": "nodemon --exec npm run start-dev",
"start": "npm run build && node ./build/index.js",
"build": "npm run clean && npm run build-babel",
@lobot
lobot / packagejson-add-to-script
Created January 5, 2022 22:51
sending-check-add-to-script
"start-dev": "babel-node ./src/index.js",
"dev": "nodemon --exec npm run start-dev",
"start": "npm run build && node ./build/index.js",
"build": "npm run clean && npm run build-babel",
"clean": "npx rimraf /F /Q build",
"build-babel": "babel src --out-dir build --source-maps inline --copy-files"
@lobot
lobot / install-babel
Created January 5, 2022 22:50
sending-check-install-babel
npm install @babel/cli @babel/core @babel/node @babel/preset-env --save-dev
@lobot
lobot / install-express
Created January 5, 2022 22:49
sending-check-install-express
npm install express mongoose cors hbs path lob dotenv
@lobot
lobot / npm-init
Created January 5, 2022 22:48
sending-check-npm-init
npm init