repl.it
@badvillain01/

thevillainer-ihatenodejs

Nodejs

No description

fork
loading
Files
  • index.js
  • static
  • templates
  • 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
29
30
31
32
const express = require('express');
const nunjucks = require("nunjucks");
const bodyParser = require('body-parser');




const app = express();

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

app.use(express.static("static"));


// nunjucks init
nunjucks.configure("./templates", {
  autoescape: true,
  express: app
});

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

app.get("/uptimerobot", (req, res) => {
  res.send("Hello UptimeRobot")
})

app.listen(process.env.PORT || 8080, () => {
  console.log('server started');
});
?