Last active
May 15, 2018 12:55
-
-
Save jkyberneees/b91e70a46b6f856f30f845750613f5df to your computer and use it in GitHub Desktop.
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 express = require('express') | |
| const bodyParser = require('body-parser') | |
| const axios = require('axios') | |
| const httpc = axios.create({ | |
| baseURL: 'http://localhost:3000', | |
| timeout: 30000 | |
| }) | |
| const app = express() | |
| app.use(bodyParser.json()) | |
| app.post('/echo', (req, res) => { | |
| res.send(req.body) | |
| }) | |
| app.get('/async', async (req, res) => { | |
| const response = await httpc.post('/echo', { | |
| node: { | |
| is: { | |
| awesome: true | |
| }, | |
| lts: [4, 6, 8, 10] | |
| } | |
| }) | |
| res.send(response.data) | |
| }) | |
| app.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment