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
// after-middleware alternative - 2 | |
const express = require('express'); | |
const app = express(); | |
const beforeMiddleware = function(req, res, next) { | |
console.log('Before middleware triggered'); | |
next(); | |
} |
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
// | |
// SPECIAL LICENSE - PROPRIETARY LICENSE AGREEMENT ONLY | |
// | |
// https://github.com/ganeshkbhat/fastprimenumbers | |
// | |
/* | |
PROPRIETARY LICENSE AGREEMENT ONLY | |
Use for your opensource projects only. If you use it or modify it for your project please spend 2 minutes of your time crediting me | |
by letting me know by either sending me an email, or logging an issue with subject heading `[User]`, or `star` my project. But |
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 checkEsm = import("check-esm"); | |
let isesm = checkEsm._isESCode("./isESCode.mjs"); | |
console.log(isesm); |
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
let regex = `import | |
(?: | |
["'\s]* | |
([\w*{}\n, ]+) | |
from\s* | |
)? | |
["'\s]* | |
([@\w/_-]+) | |
["'\s]* | |
;? |
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
/** | |
* Route Template: Config | |
* Path: ./expressjs.api.config.js | |
*/ | |
var config = { | |
"pathRoute": "/main", | |
"dbConfig": { | |
"path": "mongodb://localhost:27017/test", | |
"conf": { | |
"useNewUrlParser": true, |
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
/** | |
* ExpressJS Template Based Routes | |
Path: ./ | |
*/ | |
const path = require('path'); | |
const fs = require('fs'); | |
var app = require("express"); | |
var normalizedPath = require("path").join(__dirname, "routes"); | |
async function requireFiles(d, r = false, cb = (f) => { app.use(require(path.join(f, "index.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
/** | |
* ExpressJS Template Based Routes | |
Path: ./ | |
*/ | |
var app = require("express"); | |
const mainRoute = require("./templates/main.route.template"); | |
app.use(mainRoute); | |
app.all("*", function(req, res, next) { | |
res.send("Hello World Route Present"); |
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
var app = require("express"); | |
const mainRoute = require("./main.route") | |
app.use(mainRoute); | |
app.all("*", function(req, res, next) { | |
res.send("Hello World Route Present"); | |
}) | |
app.listen(8000, function() { |
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
function someMiddlewareName(req, res, next) { | |
console.log("Simple middleware Template"); | |
next(); | |
} | |
module.exports = someMiddlewareName |
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
{ | |
"host": "127.0.0.1", | |
"port": 11010, | |
"static": [ | |
{ | |
"path": "/web/path", | |
"folderpath": "/path/to/folder" | |
}, | |
{ | |
"folderpath": "/path/to/folder" |
NewerOlder