Skip to content

Instantly share code, notes, and snippets.

View ganeshkbhat's full-sized avatar

Krishnamurthy G B ganeshkbhat

View GitHub Profile
@ganeshkbhat
ganeshkbhat / bcompile.dll run
Created March 24, 2016 16:48
bcompile.dll run error
C:\phpsrc\php-sdk\phpdev\vc14\x64\php-7.0.4-src>nmake clean
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
Cleaning SAPI
Could Not Find C:\phpsrc\php-sdk\phpdev\vc14\x64\obj\Release_TS\php7ts.dll
Cleaning distribution build dirs
Could Not Find C:\phpsrc\php-sdk\phpdev\vc14\x64\obj\Release_TS\*.res
@ganeshkbhat
ganeshkbhat / basic-express-server-with-routehandlers-index.js
Last active October 2, 2018 02:26
ExpressJS Series: Basic ExpressJS Server
const express = require('express');
let app = express();
app.get('/', function(req, res) {res.status(200).send({status: "running", time: Date.now()})});
/* POST */
app.post('/', function(req, res) {res.status(200).send({status: "running", time: Date.now()})});
/* PUT */
app.put('/', function(req, res) {res.status(200).send({status: "running", time: Date.now()})});
/* PATCH */
app.patch('/', function(req, res) {res.status(200).send({status: "running", time: Date.now()})});
@ganeshkbhat
ganeshkbhat / basic-express-server-middleware-usage-index.js
Last active October 2, 2018 14:20
Basic Middleware usage in Express server
const express = require('express');
let app = express();
app.use(function(req, res, next) {
console.log('My logger', req.originalUrl);
next();
});
app.get('/', function(req, res) {res.status(200).send({status: "running", time: Date.now()})});
/* POST */
@ganeshkbhat
ganeshkbhat / basic-express-server-middleware-2-index.js
Created October 2, 2018 02:44
ExpressJS Series: Basic Server - Middleware Usage
const express = require('express');
let app = express();
const myFirstMiddleware = function(req, res, next) {
console.log('My logger');
next();
};
app.use(myFirstMiddleware);
@ganeshkbhat
ganeshkbhat / basic-expressjs-server-with-middleware3-index.js
Created October 2, 2018 02:51
ExpressJS Series: Basic Express Server Middleware creation for a route
const express = require('express');
let app = express();
const myFirstMiddleware = function(req, res, next) {
console.log('My logger');
next();
};
const myRouteMiddleware = function(req, res, next) {
console.log('My logger ', 'only for ', req.path);
@ganeshkbhat
ganeshkbhat / expressjs-body-parser-1-index.js
Last active October 2, 2018 14:20
ExpressJS Series: Using Middlewares to parse body
const express = require('express');
const bodyParser = require('body-parser');
let app = express();
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
@ganeshkbhat
ganeshkbhat / expressjs-body-parser-2-index.js
Last active October 2, 2018 14:19
ExpressJS Series: Parsing request body using Middlewares
const express = require('express');
const bodyParser = require('body-parser');
let app = express();
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
@ganeshkbhat
ganeshkbhat / expressjs-body-parser-3-index.js
Last active October 2, 2018 14:19
ExpressJS Series: Parsing Request Body using Middlewares
const express = require('express');
const bodyParser = require('body-parser');
let app = express();
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
@ganeshkbhat
ganeshkbhat / expressjs-body-parser-4-index.js
Last active October 2, 2018 14:18
ExpressJS Series: Parsing request body using Middlewares
const express = require('express');
const bodyParser = require('body-parser');
let app = express();
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
@ganeshkbhat
ganeshkbhat / expressjs-helmet-usage-index.js
Created October 2, 2018 14:25
ExpressJS Series: Implementing Helmet middleware
const express = require('express');
const bodyParser = require('body-parser');
const helmet = require('helmet');
let app = express();
// Implementing basic security defaults using helmet
app.use(helmet());
// parse application/x-www-form-urlencoded