diff options
author | Hsuan Lee <hsuan@cobinhood.com> | 2019-01-19 18:42:04 +0800 |
---|---|---|
committer | Hsuan Lee <hsuan@cobinhood.com> | 2019-01-19 18:42:04 +0800 |
commit | 7ae38906926dc09bc10670c361af0d2bf0050426 (patch) | |
tree | 5fb10ae366b987db09e4ddb4bc3ba0f75404ad08 /packages/testnet-faucets/src/ts/server.ts | |
parent | b5fd3c72a08aaa6957917d74c333387a16edf66b (diff) | |
download | dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.gz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.bz2 dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.lz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.xz dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.zst dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.zip |
Update dependency packages
Diffstat (limited to 'packages/testnet-faucets/src/ts/server.ts')
-rw-r--r-- | packages/testnet-faucets/src/ts/server.ts | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/packages/testnet-faucets/src/ts/server.ts b/packages/testnet-faucets/src/ts/server.ts deleted file mode 100644 index f00562000..000000000 --- a/packages/testnet-faucets/src/ts/server.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as bodyParser from 'body-parser'; -import * as express from 'express'; - -import { constants } from './constants'; -import { errorReporter } from './error_reporter'; -import { Handler } from './handler'; -import { parameterTransformer } from './parameter_transformer'; - -// Setup the errorReporter to catch uncaught exceptions and unhandled rejections -errorReporter.setup(); - -const app = express(); -app.use(bodyParser.json()); // for parsing application/json -// tslint:disable-next-line:no-unused-variable -app.use((req, res, next) => { - res.header('Access-Control-Allow-Origin', '*'); - res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'); - next(); -}); - -const handler = new Handler(); -// tslint:disable-next-line:no-unused-variable -app.get('/ping', (req: express.Request, res: express.Response) => { - res.status(constants.SUCCESS_STATUS).send('pong'); -}); -app.get('/info', handler.getQueueInfo.bind(handler)); -app.get( - '/ether/:recipient', - parameterTransformer.transform.bind(parameterTransformer), - handler.dispenseEther.bind(handler), -); -app.get( - '/zrx/:recipient', - parameterTransformer.transform.bind(parameterTransformer), - handler.dispenseZRX.bind(handler), -); -app.get( - '/order/weth/:recipient', - parameterTransformer.transform.bind(parameterTransformer), - handler.dispenseWETHOrderAsync.bind(handler), -); -app.get( - '/order/zrx/:recipient', - parameterTransformer.transform.bind(parameterTransformer), - handler.dispenseZRXOrderAsync.bind(handler), -); - -// Log to rollbar any errors unhandled by handlers -app.use(errorReporter.errorHandler()); -const DEFAULT_PORT = 3000; -const port = process.env.PORT || DEFAULT_PORT; -app.listen(port); |