Skip to content

Instantly share code, notes, and snippets.

View ulrikstrid's full-sized avatar

Ulrik Strid ulrikstrid

View GitHub Profile
plugin.route({
method: 'GET',
path: '/articles',
handler: function (request, reply) {
Wreck.request('POST', 'http://api.com./article/search', articleListMapper(), function (err, res) {
Wreck.read(res, {
json: true
}, function (err, body) {
reply.view('index.ejs', body);
});
@ulrikstrid
ulrikstrid / gist:0dc5002898f0d06c6813
Last active August 29, 2015 14:06
This route does not seem to match anything
plugin.route({
method: 'POST',
path: '/create/page/section',
config: {
validate: {
payload: schemas.sectionCreateSchema
},
pre: [{ method: models.createSection, assign: 'created'}]
},
handler: function(request, reply) {
@ulrikstrid
ulrikstrid / cors.js
Created March 5, 2015 08:08
Hapi 8.x.x CORS
server.connection({
port: internals.port,
routes: {
cors: {
origin: ['www.example.com'],
credentials: true
}
},
});
@ulrikstrid
ulrikstrid / .deployment
Created March 11, 2017 11:58
create-react-app azure deploy
[config]
command = bash deploy.sh
@ulrikstrid
ulrikstrid / docker-compose.yml
Last active June 22, 2017 11:41
Docker for create react app and node backend
version: '3'
volumes:
database_data:
driver: local
services:
################################
# Setup postgres container
################################
FROM node:latest
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
@ulrikstrid
ulrikstrid / Dockerfile.v2
Created June 24, 2017 10:59
Updated Dockerfile
FROM node:latest
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
@ulrikstrid
ulrikstrid / docker-compose.dev.yml
Created June 26, 2017 06:03
Using docker-compose and composing files
version: '3'
services:
server:
volumes:
- ./server/src:/usr/src/app/src/
command: npm run dev
frontend:
volumes:
version: '3'
services:
#test_server:
# build: ./server
# links:
# - test_database
# environment:
# - PGHOST=test_database
# - PGDATABASE=postgres
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"api": {
"matchCondition": {
"route": "/api/{*path}"
},
"backendUri": "https://<APP_URL>/api/{path}",
"responseOverrides": {
"response.headers.Content-Type": "application/json"