Reputation: 34487
I am using reactjs
in my application as front end technology. I need to use nodejs
as server side programming.
I setup the reactjs
application, it has generated project structure and package.json then I installed the express
, npm itself has added it into package.json
I created a server
directory inside my application for server side code. Here is my directory and package.json
{
"name": "rock-paper-scissors-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"express": "^4.15.3",
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
"devDependencies": {
"react-scripts": "1.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Project Structure:
So far everything is good. Now I want to generate node-js
express application https://github.com/expressjs/express which should not override my existing like package.json
$ express ??
Can anyone help what is the method of it ? or Am I doing something wrong ?
Upvotes: 1
Views: 563
Reputation: 3696
You may need to install express inside server directory. Go inside server directory by cd server
and type express myapp
. This will generate a complete separate express app using different package.json
file.
note: Expressjs generator must be installed before express myapp
command. You can install expressjs generator by npm install -g express-generator
Since this is not a good idea for going full-stack in react. You can consider a couple of starter kits for this task.
React Starter Kit — isomorphic web app boilerplate (Node.js, Express, GraphQL, React.js, Babel, PostCSS, Webpack, Browsersync)
Upvotes: 1