This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addCustomerAction = getAction('addCustomer'); | |
const editCustomerAction = getAction('editCustomer'); | |
const deleteCustomerAction = getAction('deleteCustomer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addCustomerAction = getAction('addCustomer'); | |
const editCustomerAction = getAction('editCustomer'); | |
const deleteCustomerAction = getAction('deleteCustomer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAction from './'; | |
test('action -> creates Customer', () => { | |
const createCustomerAction = getAction('addCustomer'); | |
expect(createCustomerAction).toEqual('/actions/AddCustomer'); | |
}); | |
test('action -> edit Customer', () => { | |
const editCustomerAction = getAction('editCustomer'); | |
expect(editCustomerAction).toEqual('/actions/EditCustomer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getAction from './'; | |
test('action -> creates Customer', () => { | |
const actionName = 'someAction'; | |
const action = getAction(actionName); | |
expect(action).toEqual('/actions/SomeAction'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Private key for the root cert | |
openssl genrsa -out private.key 4096 | |
# root certificate | |
openssl req -x509 -new -nodes -key private.key -subj "/C=<YOUR COUNTRY CODE>/ST=<YOUR STATE>/O=<YOUR ORG>/CN=<YOUR DOMAIN>" -sha256 -days 365 -out public.crt | |
# Private key for the server cert | |
openssl genrsa -out server.key 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as http from 'http' | |
import * as fs from 'fs' | |
import * as net from 'net' | |
import * as tls from 'tls' | |
const options = { | |
cert: fs.readFileSync('server.crt'), | |
key: fs.readFileSync('server.key'), | |
// ca: [fs.readFileSync('public2crt'), fs.readFileSync('public.crt')], | |
ca: fs.readFileSync('public.crt'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs' | |
import * as tls from 'tls' | |
var conn = tls.connect(1234, 'localhost', {}, function () { | |
if (conn.authorized) { | |
console.log('Connection authorized by a Certificate Authority.') | |
conn.write('hello from the client') | |
} else { | |
console.log('Connection not authorized: ' + conn.authorizationError) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl x509 -in public.crt -text -noout |