Skip to content

Instantly share code, notes, and snippets.

View roughy's full-sized avatar

Marco Reinwarth roughy

View GitHub Profile
@roughy
roughy / proxy-9080.js
Created March 15, 2017 21:01
NodeJS proxy server
//
// npm install http-proxy --save
//
var http = require('http'),
httpProxy = require('http-proxy');
//
// Create a proxy server with custom application logic
//
@roughy
roughy / webpack.config.js
Last active May 23, 2016 16:40
Example webpack config file with css loader and dev server proxy.
module.exports = {
entry: "./entry.js",
output: {
path: __dirname,
filename: "bundle.js"
},
devServer: {
proxy: {
'/api/*': 'https://my.backend.local'
}
@roughy
roughy / JsonHttpServer.js
Last active April 5, 2016 09:35
Start a simple node Http server for testing puposes.
/**
* Installation: npm install express path
*
* Create file json/users.json
* [
* {
* "name": "Marco",
* "description": "Test"
* },{
* "name": "Another",
@roughy
roughy / SimpleRequestHandler.py
Created March 23, 2016 16:03
Start a simple Python Http server to handle requests for test purposes.
# run with $> python SimpleRequestHandler.py 8081
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import json, sys
port = 8080
if len(sys.argv) == 2:
port = int(sys.argv[1])
@roughy
roughy / ProfileDocTest.java
Created April 8, 2013 13:51
Delete Profile DocTest example
class ProfileDocTest extends com.devbliss.doctest.DocTest {
...
/**
* Write a test annotated method like you would do for a common junit test
*/
@Test
public void testDeleteProfile() {
/*
@roughy
roughy / ProfileDocTest.java
Created April 8, 2013 13:47
Example usage of assertEqualsAndSay function
assertEqualsAndSay(HttpStatus.SC_NOT_FOUND, response3.httpStatus, "The profile is not found since it has been deleted.");
@roughy
roughy / ProfileDocTest.java
Created April 8, 2013 13:42
Example usage of makeDeleteRequest function
makeDeleteRequest(buildUri("api/v1/profile/" + profile.id));
@roughy
roughy / ProfileDocTest.java
Last active December 15, 2015 22:59
Example usage of sayNextSection function
sayNextSection("Delete a profile");
@roughy
roughy / ProfileDocTest.java
Created April 8, 2013 13:29
Example usage of say function
say("A user with admin rights can delete a profile.");
...
say("We want to delete the profile with the id \"" + profile.id + "\".");
...
say("A request to the delete-profile endpoint with the correct rigths and an existing profile id will end up in a response with the status code " + HttpStatus.SC_NO_CONTENT);
@roughy
roughy / ProfileDocTest.java
Created April 8, 2013 13:26
An empty DocTest class
class ProfileDocTest extends com.devbliss.doctest.DocTest {
}