-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (24 loc) · 820 Bytes
/
server.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
var express = require('express');
var app = express();
var PORT = process.env.PORT || 8090;
app.use("/js", express.static("public/js"));
app.use("/css", express.static("public/css"));
app.get("/", function(req, res) {
res.sendFile(process.cwd() + "/views/home.html");
});
app.get("/", function(req, res) {
res.sendFile(process.cwd() + "/views/home-contact.html");
});
app.get("/", function(req, res) {
res.sendFile(process.cwd() + "/views/githubrepos.html");
});
app.get('/repositories/:repositoryName', function(req, res) {
github.search(req.params.repositoryName, function(err, repositories) {
console.log(repositories);
var firstRepository = repositories[0];
res.send(JSON.stringify(firstRepository));
});
});
app.listen(PORT, function() {
console.log("Listening on port %s", PORT);
});