Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Last active May 15, 2018 12:55
Show Gist options
  • Select an option

  • Save jkyberneees/b91e70a46b6f856f30f845750613f5df to your computer and use it in GitHub Desktop.

Select an option

Save jkyberneees/b91e70a46b6f856f30f845750613f5df to your computer and use it in GitHub Desktop.
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