GithubHelp home page GithubHelp logo

esausilva / example-create-react-app-express Goto Github PK

View Code? Open in Web Editor NEW
378.0 9.0 143.0 2.85 MB

Example on using create-react-app with a Node Express Backend

Home Page: https://esausilva.com/2017/11/14/how-to-use-create-react-app-with-a-node-express-backend-api/

License: MIT License

HTML 16.89% CSS 5.87% JavaScript 76.98% Shell 0.27%
create-react-app node express react

example-create-react-app-express's People

Contributors

dependabot[bot] avatar esausilva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

example-create-react-app-express's Issues

Deployment

Hi esausilva,
Thanks for sharing the app. It was very useful to get me started with react/express.
I would like to ask you how I could deploy manually the files to a server. Which files and folders do I have to place on the server and what needs to be the file structure.
Thanks

Building with github repo gives 4040

Hi there.

I tried your repo in hopes of solving create-react-app and node api issues after build. In development, your project worked fine. But after building, I serve the project and it gives a 404 immediately.

'concurrently' is not recognized as an internal or external command

I was working on a project which is basically React as frontend and all the backed with Express, But was confussed how to us ethem. I cloned the repo and try runnign the "yarn dev" and it gave me the error you see in the title. I am fairly new to this type of setup so consider me as a rookie.

support for es6 syntax "SyntaxError: Unexpected token export"

I am facing this error while using es6 syntax
SyntaxError: Unexpected token export
Is there any way to upgrade the babel or web pack to support es6 syntax

How to reproduce the error
create a file test.js inside root folder

import axios from "axios"
const fun = function(){
    // write your logic
}
export default fun;

error log

SyntaxError: Unexpected token export
[0]     at Module._compile (internal/modules/cjs/loader.js:723:23)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[0]     at Module.load (internal/modules/cjs/loader.js:653:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
[0]     at Module.require (internal/modules/cjs/loader.js:692:17)
[0]     at require (internal/modules/cjs/helpers.js:25:18)
[0]     at Object.<anonymous> (/home/mirsahib/Desktop/MERN_WS/example-create-react-app-express/routes/scraper.routes.js:2:27)
[0]     at Module._compile (internal/modules/cjs/loader.js:778:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

missing eslint configuration

Getting the following error on VS Code

Failed to load the ESLint library for the document /Users/[username]/projects/example-create-react-app-express/engine.js
To use ESLint please install eslint by running npm install eslint in the workspace folder example-create-react-app-express

I suppose this project relies on a global Eslint installation?
If so maybe I'd suggest migrating to a local configuration, since global dependencies are no longer the recommend way to use JS dependencies, unless in very specific cases.

React app client port 5000

Hi, thank you for this tutorial.
However, I dont know why my react client starts at port 5000, which is supposed to be the port for express backend. Could you let me know how to fix this. Thanks.

Backend not working properly post-production

After deploying my app on Heroku, I get the following error:
GET https://weetweet.herokuapp.com/api/hello 503 (Service Unavailable)

My locally hosted app (which works perfectly) is running on localhost:3000 and the express server is running on localhost:5000. I set up the proxy as you did

{ "proxy": "http://localhost:5000/" }
and the fetch call like this fetch('/api/hello') and fetch('/api/posts') (i switched world to posts)

Should I be doing something else so that Heroku can serve the backend somewhere?

Here is my code: https://github.com/andrew-levy/Twitter-React-Express
Here is the web app: https://weetweet.herokuapp.com/

p.s. Thanks for the code boilerplate and the article guiding me through the process!

heroku is not running my backend

Here is my package json in the serverside
{ "name": "tidy-sum", "version": "1.0.0", "scripts": { "client": "cd client && yarn start", "server": "nodemon server.js", "dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\"", "start": "node server.js", "heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build" }, "dependencies": { "body-parser": "^1.18.3", "cors": "^2.8.5", "express": "^4.16.4", "knex": "^0.16.3", "morgan": "^1.9.1", "pg": "^7.8.0" }, "devDependencies": { "concurrently": "^4.0.1" } }

../node_modules/react-redux/es/components/Provider.js Module not found: Can't resolve 'react' in '/home/hutber/node_modules/react-redux/es/components'

I am now trying to add redux to the app, I am wondering are there an alisis in place that will restrict the 'redux' from being reconised?

As when booting up the server I get the following.
../node_modules/react-redux/es/components/Provider.js Module not found: Can't resolve 'react' in '/home/hutber/node_modules/react-redux/es/components'

{
  "name": "example-create-react-app-express",
  "version": "1.0.0",
  "description": "Example on using create-react-app with a Node Express Backend",
  "author": {
    "name": "Esau Silva",
    "email": "[email protected]",
    "url": "https://esausilva.com"
  },
  "license": "MIT",
  "scripts": {
    "client": "cd client && npm start",
    "server": "nodemon server.js",
    "dev": "concurrently --kill-others-on-fail \"npm run server\" \"npm run client\"",
    "dev:server": "cd client && npm run build && cd .. && npm start",
    "start": "node server.js",
    "heroku-postbuild": "cd client && npm install && npm install --only=dev --no-shrinkwrap && npm run build"
  },
  "dependencies": {
    "body-parser": "^1.18.3",
    "connected-react-router": "^5.0.1",
    "express": "^4.16.4",
    "google-spreadsheets": "^2.0.0",
    "react-redux": "5.0.7",
    "redux": "^4.0.1"
  },
  "devDependencies": {
    "concurrently": "^4.0.1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/esausilva/example-create-react-app-express.git"
  },
  "bugs": {
    "url": "https://github.com/esausilva/example-create-react-app-express/issues"
  },
  "keywords": [
    "node",
    "express",
    "create-react-app"
  ]
}

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.