Skip to content

Instantly share code, notes, and snippets.

View kindziora's full-sized avatar
:electron:
coding

alexander kindziora kindziora

:electron:
coding
View GitHub Profile
@kindziora
kindziora / index.ts
Created January 13, 2020 08:10 — forked from Curtis017/index.ts
Simple middleware implementation using typescript and ES6
import pipeline, { Middleware } from './pipeline';
const step1: Middleware<any, any> = (req, res, next) => {
if (req.body) {
console.log(`STEP 1: \n req: ${JSON.stringify(req)}\n res: ${JSON.stringify(res)}`);
next();
}
}
const step2: Middleware<any, any> = async (req, res, next) => {
@kindziora
kindziora / gist:6b9fdd511d4adda492906cd98929f14e
Last active November 30, 2017 11:21
Markdown cheat sheet

Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one

@kindziora
kindziora / simplerXHR.js
Last active June 28, 2020 07:32 — forked from sindresorhus/simplexhr.js
Simpler XMLHttpRequest wrapper
var simplerXHR = function( method, url) {
var _xhr = new XMLHttpRequest();
_xhr.open( method, url );
_xhr.setup = function(cb){ // hacky? maybe
cb(_xhr);
return _xhr;
};
_xhr.done = function(cb){ // hacky? maybe
_xhr.onreadystatechange = function() {
if ( _xhr.readyState === 4 ) {
@kindziora
kindziora / restAPI.markdown
Created April 21, 2016 21:18 — forked from iksose/restAPI.markdown
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.