Skip to content

Instantly share code, notes, and snippets.

View Janoyan's full-sized avatar

Meruzh Janoyan

View GitHub Profile
$ heroku login
$ cd your-project-folder
$ git init
$ heroku git:remote -a your-app-name
$ git add .
$ git commit -am "Initial commit"
$ git push heroku master
worker: node ip-script.js
const axios = require('axios');
const Heroku = require('heroku-client');
const heroku = new Heroku({ token: process.env.API_KEY })
const URLS = [
'https://api.myip.com/?id=1',
'https://api.myip.com/?id=2',
'https://api.myip.com/?id=3',
'https://api.myip.com/?id=4',
.env=API_USERS_
.env.test=API_USERS_TEST_
mappings=()
while IFS= read -r line; do
mappings+=("$line")
done < mappings.txt
for value in "${mappings[@]}" ; do
env_path=${value%=*};
scp $env_path xx.xx.xx.xx:/var/www/api-users/$env_path
done
version: 2
jobs:
deploy:
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "c1:37:bf:df:a7:a1:04:7c:be:d1:46:83:9a:bf:76:73"
- run:
name: Add to known_hosts
mappings=()
while IFS= read -r line; do
mappings+=("$line")
done < mappings.txt
for value in "${mappings[@]}" ; do
prefix=${value#*=};
env_path=${value%=*};
rm -f "$env_path" && for l in $(printenv | grep ^"$prefix"); do echo ${l#$prefix} >> "$env_path"; done
done
import { NextFunction, Request, Response } from 'express';
import BaseError from './BaseError';
import InternalServerError from './InternalServerError';
const errorHandler = (
error: any,
req: Request,
res: Response,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
next: NextFunction,
import BaseError from './BaseError';
import { ErrorData } from './ErrorData';
export class NotFoundError extends BaseError {
constructor(message: string = 'Not found', slug: string = 'not-found') {
super(404, message, slug);
}
getErrorData(): ErrorData {
return {
import { ErrorData } from './ErrorData';
abstract class BaseError extends Error {
code: number;
slug: string;
constructor(code: number, message: string, slug: string) {
super(message);