Skip to content

Commit

Permalink
Merge pull request Aniket965#828 from rciupei/master
Browse files Browse the repository at this point in the history
Added axios to do example
  • Loading branch information
shubham-sidd97 authored Oct 8, 2018
2 parents fab8cfe + 2b1a258 commit cdacf05
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Expressjs/axiosToDo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let express = require("express");
let axios = require("axios");

let app = express();

app.get("/todo", (req, res) => {
return axios
.get("https://jsonplaceholder.typicode.com/todos/1")
.then(response => res.send(response.data))
.catch(err => res.send(err));
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, console.log(`Server has started on port ${PORT}`));

0 comments on commit cdacf05

Please sign in to comment.