forked from MichaelWehar/Crossword-Layout-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (37 loc) · 1.85 KB
/
index.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
// set up Express
var express = require('express');
var app = express();
//const { jsPDF } = require("jspdf"); // will automatically load the node version
// set up BodyParser
// var bodyParser = require('body-parser');
// app.use(bodyParser.urlencoded({ extended: true }));
// set up EJS
//app.set('view engine', 'ejs');
app.use(express.static('public'))
// input_json = [{"clue":"that which is established as a rule or model by authority, custom, or general consent","answer":"standard"},{"clue":"a machine that computes","answer":"computer"},{"clue":"the collective designation of items for a particular purpose","answer":"equipment"},{"clue":"an opening or entrance to an inclosed place","answer":"port"},{"clue":"a point where two things can connect and interact","answer":"interface"}]
// var clg = require("crossword-layout-generator");
// var layout = clg.generateLayout(input_json)
// var rows = layout.rows;
// var cols = layout.cols;
// var table = layout.table; // table as two-dimensional array
// var output_html = layout.table_string; // table as plain text (with HTML line breaks)
// var output_json = layout.result; // words along with orientation, position, startx, and starty
app.use('/', (req, res) => {
//console.log(output_json)
res.sendFile(__dirname + '/public/index.html')
//res.render("index")
});
// app.use("layout_generator.js", (req, res) => {
// res.send('layout_generator.js')
// })
/*************************************************
Do not change anything below here!
*************************************************/
//app.use('/public', express.static('public'));
// this redirects any other request to the "all" endpoint
//app.use('/', (req, res) => { res.redirect('/home'); } );
// this port number has been assigned to your group
var port = 5001
app.listen(port, () => {
console.log('Listening on port ' + port);
});