-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
64 lines (50 loc) · 1.64 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const express = require("express");
const bodyParser = require("body-parser");
const Instagram = require("instagram-web-api");
const app = express();
app.use(bodyParser.urlencoded({extended:true}));
app.use(express.static("public"));
app.set('view engine', 'ejs');
// SET UP INSTAGRAM
// const client = new Instagram({username: 'javinalcharles', password: 'CadfEr05?13'});
//
// client.login().then(() => {
// console.log("Instagram user successfully logged in.");
// });
// GLOBAL VARIABLES
const PORT = process.env.PORT || 3000;
// async function getPhotos() {
// let photos = await client.getPhotosByUsername({username: 'volition.nz', first: 6});
//
// return photos;
// }
// ROUTES
app.get("/", function(req, res){
res.render("index", {pageTitle: "home"});
});
app.get("/about", function(req, res){
// let data = {pageTitle: "about"};
// client.getPhotosByUsername({username: 'volition.nz', first: 6}).then((photos) => {
// console.log("Image suucessfully fetched");
// data.photos = photos;
// console.log(photos.user.edge_owner_to_timeline_media.edges);
// res.render("index", data);
// }, (reason) => {
// console.log("Something went wrong while try to fetch images.");
// data.rejection = reason;
// res.render("index", data);
// });
res.render("index", {pageTitle: "about"});
});
app.get("/classes", function(req, res){
res.render("index", {pageTitle: "classes"})
});
app.get("/services", function(req, res){
res.render("index", {pageTitle: "services"})
});
app.get("/team", function(req, res){
res.render("index", {pageTitle: "team"})
});
app.listen(PORT, function(){
console.log("Server Online. Listening at port " + PORT);
});