Skip to content

Instantly share code, notes, and snippets.

View macedigital's full-sized avatar
💭
I may be slow to respond.

Matthias Adler macedigital

💭
I may be slow to respond.
View GitHub Profile
@macedigital
macedigital / index.js
Created April 26, 2018 11:11
Handle runtime exception with express-js
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const xmlparser = require('express-xml-bodyparser');
app.use(xmlparser());
app.post('/xml', (req, res, next) => {
console.log(req.body); // handle parsed xml
@macedigital
macedigital / express-xml-bodyparser.js
Created January 16, 2017 22:17
Alternative for parsing incoming XML in express apps, instead of using https://github.com/macedigital/express-xml-bodyparser.
var express = require('express'),
typeis = require('type-is');
var app = express();
var xmlParseOptions = {
async: false, // Setting to `true` causes issues with exceptions
explicitArray: false,
trim: true,
normalize: true,
#!/usr/bin/env bash
# Names of latest versions of each package
export VERSION_PCRE=pcre-8.39
export VERSION_ZLIB=zlib-1.2.8
export VERSION_LIBRESSL=libressl-2.4.2
export VERSION_NGINX=nginx-1.11.3
# URLs to the source directories
export SOURCE_LIBRESSL=http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/
@macedigital
macedigital / express-xml-bodyparser-sample.js
Created September 18, 2015 13:45
Minimal example for using express-body-parser middleware
var express = require('express');
var app = express();
var http = require('http');
var server = http.createServer(app);
var xmlparser = require('express-xml-bodyparser');
// fyi: it'd be better to attach the parser to wanted routes only
app.use(xmlparser());
app.post('/xml', function(req, res, next) {
@macedigital
macedigital / gist:ea540099097f7ec4c2f5
Last active August 29, 2015 14:19
Solarium 3.x Solr 5.1.x Curl Adapter GET method fix
--- symfony/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php (revision )
+++ symfony/vendor/solarium/solarium/library/Solarium/Core/Client/Adapter/Curl.php (revision )
@@ -155,10 +155,6 @@
curl_setopt($handler, CURLOPT_PROXY, $proxy);
}
- if (!isset($options['headers']['Content-Type'])) {
- $options['headers']['Content-Type'] = 'text/xml; charset=utf-8';
- }
-
@macedigital
macedigital / rss.jade
Created April 1, 2014 11:15
Using jade template to render rss-feed in nodejs
doctype xml
rss(version='2.0')
channel
title= feed.title
description= feed.description
link= feed.link
language= feed.en
for item in posts
item
title= item.title