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 http from 'http'; | |
import { Buffer } from 'buffer'; | |
const server = http.createServer(); | |
server.on('request', (req:http.IncomingMessage, res:http.ServerResponse) => { | |
if(req.headers.authorization) { // req.headers.authorization = "Basic a3V6dW5vaGE6YWFh" | |
const encodedPass = req.headers.authorization.split(' ')[1]; // encodedPass = "a3V6dW5vaGE6YWFh" | |
const decodePass = Buffer.from(encodedPass, 'base64').toString('utf8'); // decodedPass = "kuzunoha:hogehoge" | |
const auth = {username:decodePass.split(':')[0], password:decodePass.split(':')[1]}; // auth = {username:kuzunoha, password:hogehoge} |
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
name: Node CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 12.x | |
uses: actions/setup-node@v1 | |
with: |