@timmy_i_chen/

react express template

Express

Template for node/express backend + react frontend

fork
loading
Files
  • index.js
  • client
  • public
  • views
  • .babelrc
  • config.js
  • package-lock.json
  • package.json
  • webpack.config.js
  • webpackRunner.js

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6361743068237975","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgZXhwcmVzcyA9IHJlcXVpcmUoJ2V4cHJlc3MnKTsKY29uc3QgZW5naW5lcyA9IHJlcXVpcmUoJ2NvbnNvbGlkYXRlJyk7CmNvbnN0IGNvbmZpZyA9IHJlcXVpcmUoJy4vY29uZmlnJyk7CgpyZXF1aXJlKCcuL3dlYnBhY2tSdW5uZXInKTsKCmNvbnN0IGFwcCA9IGV4cHJlc3MoKTsKCmFwcC5lbmdpbmUoJ25qaycsIGVuZ2luZXMubnVuanVja3MpOwphcHAuc2V0KCd2aWV3IGVuZ2luZScsICduamsnKTsKYXBwLnNldCgndmlld3MnLCBfX2Rpcm5hbWUgKyAnL3ZpZXdzJyk7CmFwcC51c2UoZXhwcmVzcy5zdGF0aWMoJ3B1YmxpYycpKTsKCmFwcC5nZXQoJyonLCAocmVxLCByZXMpID0+IHsKICByZXMucmVuZGVyKCdwYWdlcy9pbmRleCcsIHsKICAgIGFwcG5hbWU6IGNvbmZpZy5BUFBOQU1FCiAgfSk7Cn0pOwoKYXBwLmxpc3Rlbihjb25maWcuUE9SVCwgZnVuY3Rpb24gKCkgewogIGNvbnNvbGUubG9nKGBBcHAgY3VycmVudGx5IHJ1bm5pbmc7IG5hdmlnYXRlIHRvIGxvY2FsaG9zdDoke2NvbmZpZy5QT1JUfSBpbiBhIHdlYiBicm93c2VyLmApOwp9KTsKCi8vIGR1ZSB0byBjdXJyZW50IHJlcGwuaXQgbGltaXRhdGlvbnMgeW91IG5lZWQgdG8gcmVzdGFydAovLyB0aGUgcmVwbCB0d2ljZSBmb3IgdGhlIGJ1bmRsZS5qcyB0byB1cGRhdGUuCg=="},"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
25
26
const express = require('express');
const engines = require('consolidate');
const config = require('./config');

require('./webpackRunner');

const app = express();

app.engine('njk', engines.nunjucks);
app.set('view engine', 'njk');
app.set('views', __dirname + '/views');
app.use(express.static('public'));

app.get('*', (req, res) => {
  res.render('pages/index', {
    appname: config.APPNAME
  });
});

app.listen(config.PORT, function () {
  console.log(`App currently running; navigate to localhost:${config.PORT} in a web browser.`);
});

// due to current repl.it limitations you need to restart
// the repl twice for the bundle.js to update.