Create project folder and initialize an npm project
> mkdir crm
> cd crm
> npm init -y
> git add .
> git commit -m "Initial Commit"
> git remote add origin https://github.com/manaseer/crm.git
> git push -u origin master
Install MongoDB and then install Express
and Mongoose
> npm install express body-parser mongoose nodemon
> touch .gitignore
Install MongoDB and then install Express
and Mongoose
> npm install --save-dev babel-cli babel-preset-env
Inside .gitignore
add the following
- node_modules
import express from 'express' ;
const PORT = 3000;
const app = express();
app.get('/',(req,res)=>{
res.send('Node and express server is running on port '+PORT);
});
app.listen(PORT,()=>{
console.log('Express server is running on '+PORT);
});
We'll create a parent src
folder and inside this create following three subfolders
- controllers
- models
- routes
> mkdir src && cd src && mkdir controllers && mkdir models && mkdir routes