diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-18 10:49:16 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-18 10:49:16 +0000 |
| commit | c1ce89359a7b54ec97b54ce577e5534c180c5c4b (patch) | |
| tree | 39f8333533131fc0b0efba99a0517e11a63706ce /server.js | |
| parent | 0a47900db45ce82d10ad09a6aee85e1ba68a9063 (diff) | |
Various fixes, see changelog for details.
Diffstat (limited to 'server.js')
| -rw-r--r-- | server.js | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/server.js b/server.js deleted file mode 100644 index c937cd0..0000000 --- a/server.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Created by warefhaque on 2016-07-16. - */ - -/*change the __dirname statically for now*/ - -var __dirname = '/Users/warefhaque/CSC309/solutions_repo'; - -const express = require('express'); -const app = express(); -const bodyParser = require('body-parser'); -var dbFile = require("./node_simple.js"); -var http = require("http"); -var fs = require("fs"); - -app.use(bodyParser.urlencoded({extended: true})); -app.use(bodyParser.json()); -/*LOADS ALL STATIC FILES FROM THE DIRECTORY __dirname*/ -app.use(express.static(__dirname)); - -app.listen(3000, function() { - console.log('listening on http://localhost:3000/'); -}); - -app.get('/exams',function (req,res) { - console.log(req.query.search); - var courseName = req.query.search; - res.redirect("http://localhost:3000/exams.html/?course_name="+courseName); -}); - -app.get('/exams.html', function (req,res) { - /*LOADS ALL THE STATIC FILES REALTIVE TO THE REDIRECTED URL*/ - app.use('/exams.html', express.static(__dirname)); - res.sendFile(__dirname+'/exams.html'); -}); - -function getExamsForCourseCode(courseCode) { - dbFile.get_all_exams(courseCode, function (exams) { - if (exams.length == 0){ - console.log("Nothing was found"); - } - else { - console.log(exams); - } - }); -} |
