This file contains hidden or 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
| $ 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 |
This file contains hidden or 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
| worker: node ip-script.js |
This file contains hidden or 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 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', |
This file contains hidden or 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
| .env=API_USERS_ | |
| .env.test=API_USERS_TEST_ |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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 { 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, |
This file contains hidden or 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 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 { |
This file contains hidden or 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 { ErrorData } from './ErrorData'; | |
| abstract class BaseError extends Error { | |
| code: number; | |
| slug: string; | |
| constructor(code: number, message: string, slug: string) { | |
| super(message); |
NewerOlder