@timmy_i_chen/

LameBrokenDemos

Express

No description

fork
loading
Files
  • index.js
  • public
  • routes
  • views
  • db.js
  • package-lock.json
  • package.json

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.21383140133920575","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgZXhwcmVzcyA9IHJlcXVpcmUoJ2V4cHJlc3MnKTsKY29uc3QgYm9keVBhcnNlciA9IHJlcXVpcmUoJ2JvZHktcGFyc2VyJyk7Cgpjb25zdCBhcHAgPSAgICBleHByZXNzKCk7CgphcHAudXNlKGJvZHlQYXJzZXIuanNvbigpKTsKYXBwLnVzZShib2R5UGFyc2VyLnVybGVuY29kZWQoeyBleHRlbmRlZDogdHJ1ZSB9KSk7CmFwcC51c2UoZXhwcmVzcy5zdGF0aWMoJ3B1YmxpYycpKTsKCmFwcC51c2UocmVxdWlyZSgnLi9yb3V0ZXMvZ3Vlc3Rib29rJykpOwoKYXBwLmdldCgnL2FwaS1kb2NzJywgKHJlcSwgcmVzKSA9PiB7CiAgcmVzLnNlbmRGaWxlKF9fZGlybmFtZSArICcvdmlld3MvYXBpLWluZGV4Lmh0bWwnKTsKfSk7CgphcHAuZ2V0KCcvJywgKHJlcSwgcmVzKSA9PiB7CiAgcmVzLnNlbmRGaWxlKF9fZGlybmFtZSArICcvdmlld3MvaW5kZXguaHRtbCcpOwp9KTsKCmNvbnN0IHBvcnQgPSBwcm9jZXNzLmVudi5QT1JUIHx8IDgwODA7CmFwcC5saXN0ZW4ocG9ydCwgJzAuMC4wLjAnLCAoKSA9PiB7CiAgY29uc29sZS5sb2coYFNlcnZlciBzdGFydGVkIG9uIHBvcnQgJHtwb3J0fWApOwp9KTsK"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const express = require('express');
const bodyParser = require('body-parser');

const app =    express();

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static('public'));

app.use(require('./routes/guestbook'));

app.get('/api-docs', (req, res) => {
  res.sendFile(__dirname + '/views/api-index.html');
});

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

const port = process.env.PORT || 8080;
app.listen(port, '0.0.0.0', () => {
  console.log(`Server started on port ${port}`);
});