- Install Dependencies
npm init npm install --save-dev ts-node typescript tslib express @types/express
- Create
server.ts
in root folder of your app.
/* | |
MIT License | |
Copyright (c) 2019 Erik Hellman | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Example", | |
"type": "node", | |
"request": "launch", | |
"runtimeExecutable": "node", | |
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], |
'use strict' | |
// Ideally, this table would be shuffled... | |
// 256 will be the highest value provided by this hashing function | |
let table = [...new Array(256)].map((_, i) => i) | |
const hash8 = (message, table) => { | |
return message.split('').reduce((hash, c) => { | |
return table[(hash + c.charCodeAt(0)) % (table.length - 1)] | |
}, message.length % (table.length - 1)) |
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
cat jwtRS256.key | |
cat jwtRS256.key.pub |
azu/typescript1.5-es6module-npm at tsconfig-gulp
tsconfigが未対応なtsc1.4でもtsconfig.jsonをただの設定ファイル置き場として使う例。
filesGlob
はatom-typescriptの独自拡張だけど
.
├── README.md
├── build
│ ├── bundle.js
// With Javascript, create a new file and send it to a CouchDB database as an attachment of a Document | |
// Code inspired by "NEW TRICKS IN XMLHTTPREQUEST2" by Eric Bidelman | |
// http://www.html5rocks.com/en/tutorials/file/xhr2/ | |
/* | |
* There are two ways of accomplishing this. The first way will always result in a filename of "blob", which is | |
* bummer. The second way you will be able to name the file what you want. Note that these examples | |
* assume you have the ID of the database, the ID of the Document, and the most recent revision hash of that Document. | |
*/ |
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375"," |