Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION] - How can I integrate Express into this starter kit?

See original GitHub issue

Hey Cory

Coming from your React/Redux PluralSight course, I appreciated the integration with Express as it would allow me to setup /proxy routes for private requests that won’t exist within our services, e.g. if I wanted to add these sort of auth paths to this sample:

However, I’m not certain how I can control server-side routing with react-slingshot, and I don’t love the idea of generating a separate application to deal with the highly coupled proxy requests I’d likely need for performing secure operations.

Or maybe I’m thinking about this wrong. I’m having trouble wrapping my head around the separation between client and server requests, and how the front-end (bundle.js) would handle a request that the server could respond to.

Thanks for any help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

yagamicodercommented, Jan 14, 2017

I managed to get Express working in my app by using this code:

import historyApiFallback from 'connect-history-api-fallback';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import {chalkSuccess} from './chalkConfig';
import config from '../';
import express from 'express';
import http from 'http';

const bundler = webpack(config);
const app = express();
const server = http.createServer(app);
console.log(chalkSuccess('Starting Express server...'));

app.use(webpackDevMiddleware(bundler, {
    // Dev middleware can't access config, so we provide publicPath
    publicPath: config.output.publicPath,

    // These settings suppress noisy webpack output so only errors are displayed to the console.
    noInfo: false,
    quiet: false,
    stats: {
      assets: false,
      colors: true,
      version: false,
      hash: false,
      timings: false,
      chunks: false,
      chunkModules: false

    // for other settings see
console.log(chalkSuccess('Express server is listening on port: ' + server.address().port));

Hopefully this helps someone out there.


iwoorkcommented, Nov 14, 2017

@spartan082189 where did you put that code and how to run it? thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React & Express Starter Pack For Full Stack Development
In this video we will create a starter pack for full stack React and Express development. I will show you how to integrate...
Read more >
Express/Node introduction - Learn web development | MDN
Integrate with "view" rendering engines in order to generate responses by inserting data into templates. Set common web application settings ...
Read more >
How To Get Started with Node.js and Express - DigitalOcean
The first line here is grabbing the main Express module from the package you installed. This module is a function, which we then...
Read more >
Set up your Node.js and Express development environment
In this guide, we'll cover how to set up your Node.js development environment for an Express project. We'll also walk through some helpful ......
Read more >
Node.js and Express Tutorial: Build a Website Using Pug - Auth0
Learn how to use Express and the Pug template engine to build a website in Node.js. Create user interfaces using Pug and CSS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found