Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move server setup and import courses from #34

Merged
merged 1 commit into from
Nov 23, 2023
Merged
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
46 changes: 23 additions & 23 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ const addcheckinLinks = require('./features/addcheckinLinks.js')

///////////////////////////////////////////// IMPORT FEATURES END //////////////////////////////////////////////

/////////////////////////////////////////////////// SETUP /////////////////////////////////////////////////////

// This displays message that the server running and listening to specified port
//const port = process.env.PORT || 8080;
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Listening on port ${port}`));

var courses = []; // Predefined courses from allCourses.md


// import courses from allCourses.md
try {
var courses = fs.readFileSync('../allCourses.md', 'utf8').split('\n');
//test courses are read correctly
// for (let i = 0; i < courses.length; i++) {
// console.log(courses[i]);
// }
} catch (e) {
console.log('Error:', e.stack);
}

////////////////////////////////////////////////// SETUP END ///////////////////////////////////////////////////

///////////////////////////////////////////////// FEATURES /////////////////////////////////////////////////////

/**
Expand Down Expand Up @@ -53,29 +76,6 @@ function performModifications(cal, stepsString) {

/////////////////////////////////////////////// FEATURES END////////////////////////////////////////////////////

/////////////////////////////////////////////////// SETUP /////////////////////////////////////////////////////

// This displays message that the server running and listening to specified port
//const port = process.env.PORT || 8080;
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Listening on port ${port}`));

var courses = []; // Predefined courses from allCourses.md


// import courses from allCourses.md
try {
var courses = fs.readFileSync('../allCourses.md', 'utf8').split('\n');
//test courses are read correctly
// for (let i = 0; i < courses.length; i++) {
// console.log(courses[i]);
// }
} catch (e) {
console.log('Error:', e.stack);
}

////////////////////////////////////////////////// SETUP END ///////////////////////////////////////////////////

/////////////////////////////////////////////////// API V1 /////////////////////////////////////////////////////
app.get('/api/v1/:uniqueAPI/tt.ics', function (req, res) {
console.log("V1 API hit")
Expand Down
Loading