Giter VIP home page Giter VIP logo

hackathon's Introduction

React-Express-Node Starter

Starter project for building apps with React, NodeJS and ExpressJS with Hot Module Reloading.

Like this starter project? โญ๏ธ it on Github to support it! ๐Ÿ˜„

Development

To run the development build, run npm run start:dev.

The server is automatically built and reloaded using nodemon, and the client is Hot-module-reloaded. The client is avialable on port 9000 and the server APIs are available on port 9001.

Production

To build this project for production, run npm start.

This will build the client and server files, and start the server on port 9001

FAQ

I don't want to transpile my server files

This project transpiles the server files into a server.bundle.js. This is for those who want to use unsupported ESNext features in Node, such as ES Modules, or for those who want to add in type checking via Typescript or FlowType.

If you don't want your server files transpiled/compiled through webpack, edit the following:

  • In package.json scripts section
    • Remove start:server and build:server.
    • Change start:dev to "concurrently 'npm run start:client' 'nodemon server/index.js'"
    • Change start to "concurrently 'npm run build:client' 'NODE_ENV=production node server/index.js"
  • In server/index.js
    • Modify import express from 'express to const express = require('express') on line 1.

I don't want my server to serve my client bundle in production / I want to upload my client to a CDN

In production, this project bundles the client and has the server serve both the client as well as the endpoints. If you do not want the API server to serve the client-side code, then make the following change

  • In server/index.js, remove the block containing express.static('/', 'dist') (lines 7-9).

hackathon's People

Contributors

mookth789 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.