Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"cors": "^2.8.5"
}
}
8 changes: 8 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const express = require("express");
const morgan = require("morgan");
const cookieParser = require("cookie-parser");
const cors = require("cors")
const PORT = 5005;

// STATIC DATA
Expand All @@ -20,6 +21,7 @@ app.use(morgan("dev"));
app.use(express.static("public"));
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(cors())


// ROUTES - https://expressjs.com/en/starter/basic-routing.html
Expand All @@ -29,7 +31,13 @@ app.get("/docs", (req, res) => {
res.sendFile(__dirname + "/views/docs.html");
});

app.get("/api/cohorts", (req, res) => {
res.sendFile(__dirname + "/cohorts.json")
})

app.get("/api/students", (req, res) => {
res.sendFile(__dirname + "/students.json");
});
// START SERVER
app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}`);
Expand Down
23 changes: 23 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"homepage": "https://github.com/ironhack-labs/cohort-tools-project#readme",
"dependencies": {
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"express": "^4.18.2",
"morgan": "^1.10.0",
"nodemon": "^3.0.1"
Expand Down