repl.it
@The6thGrade6th/

LucasFrias.com

Express

No description

fork
loading
Files
  • index.js
  • public
  • Packager files
  • package-lock.json
  • package.json
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
const express = require('express');
const bodyParser = require('body-parser');

const app = express();

ipcount = 0

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.use(express.static('public'));

app.get('/', (req, res) => {
  res.sendFile('public/index.html');
});

app.use(function(req, res) {
  res.send("<h2>404: Page Not Found</h2><br><p>This area has been destroyed and used to worship our turtle overlords.<br><br>ALL PRAISE THE TURTLES.<br>It will never be found again. Probally.", 404)
  console.log ("LOG: 202")
});

// Handle 500
app.use(function(error, req, res, next) {
  res.send('500: Internal Server Error.<br> <p>Yes, this is bad. It means the web page just does not work. Like, code wise. So DEFCON 1 is active for the end times.', 500);
});

app.listen(3000, () => console.log('Local Host Deployed Sucessfully.'));
Fetching token
?