forked from cs4241-21a/a4-creative-coding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (26 loc) · 845 Bytes
/
server.js
File metadata and controls
35 lines (26 loc) · 845 Bytes
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
const express = require('express'),
app = express(),
cors = require('cors'),
path = require('path'),
router = express.Router(),
port = process.env.PORT || 3000
/*
app.get('/', function(req, res){
res.render('index.ejs');});
*/
app.use( cors() )
// make all the files available
// https://expressjs.com/en/starter/static-files.html
app.use( express.static('public') )
app.use( express.static('assets') )
// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
response.sendFile(__dirname + "/views/index.html");
// console.log(__dirname);
});
// listen for requests :)
const listener = app.listen(process.env.PORT, () => {
console.log("Your app is listening on port " + listener.address().port);
// console.log(__dirname);
});
//app.listen( 3000 )