-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from thanhson1085/master
fix gasPrice for tomomaster
- Loading branch information
Showing
11 changed files
with
142 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
const express = require('express') | ||
const config = require('config') | ||
const request = require('request') | ||
const router = express.Router() | ||
|
||
router.get('/', async function (req, res, next) { | ||
let db = req.query.db | ||
let query = req.query.q | ||
query = encodeURI(query).replace('=', '%3D').replace(';', '%3B') | ||
let epoch = req.query.epoch | ||
let apiKey = config.get('grafanaApiKey') | ||
let url = `${config.get('grafanaUrl')}/api/datasources/proxy/1/query?db=${db}&q=${query}&epoch=${epoch}` | ||
request({ | ||
url: url, | ||
json: true, | ||
headers: { Authorization: `Bearer ${apiKey}` } | ||
}, (error, response, body) => { | ||
if (error) { | ||
return res.json(error) | ||
} | ||
return res.json(body) | ||
}) | ||
}) | ||
|
||
module.exports = router |
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
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
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
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
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
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
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
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
Oops, something went wrong.