Skip to content

Commit

Permalink
Added axios to do example
Browse files Browse the repository at this point in the history
  • Loading branch information
razvicm committed Oct 8, 2018
1 parent 12eb172 commit 2b1a258
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 2b1a258

Please sign in to comment.