├── .gitignore ├── .vscode └── settings.json ├── Procfile ├── README.md ├── client ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ │ ├── DisplayUsers.jsx │ │ └── Form.jsx │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── serviceWorker.js └── yarn.lock ├── models └── user.js ├── package-lock.json ├── package.json ├── public └── images │ ├── engines.png │ ├── heroku-postbuild.png │ ├── mongodb_uri.png │ ├── node_env.png │ └── port.png ├── routes └── index.js └── server.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production build 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.background": "#452232", 4 | "titleBar.activeBackground": "#613046", 5 | "titleBar.activeForeground": "#FCF9FA" 6 | } 7 | } -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: npm start -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deploying MERN Stack to Heroku 2 | 3 | 4 | We're going to walk you how to deploy a MERN stack app to Heroku. 5 | 6 | MERN (Mongo, express, React, and Nodejs) 7 | 8 | ### Perequesites 9 | 1- [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) 10 | 11 | 2- [Git Installed](https://git-scm.com/downloads) 12 | 13 | 14 | Before you move on the steps, make sure you are logged in with your Heroku Account inside your terminal. You can run `heroku login` in your terminal and then follow the steps to make sure you're logged in. 15 | 16 | > Note: all these steps below are done inside the main `server.js` file. In our case, inside server.js. 17 | 18 | Assuming you have the following folder structure 19 | 20 | ``` 21 | ├── client 22 | │ ├── build 23 | │ ├── public 24 | │ ├── src 25 | │ ├── .gitignore 26 | │ ├── package.json 27 | │ ├── README.md 28 | │ └──src 29 | ├── models 30 | │ ├── user.js 31 | │ ├── books.js 32 | │ └── index.js 33 | ├── public 34 | ├── routes 35 | ├── .gitignore 36 | ├── server.js 37 | ├── package.json 38 | └── README.MD 39 | ``` 40 | 41 | 42 | #### Step 1 43 | > `server.js` 44 | 45 | We can't assume that Heroku will have PORT 8080 available. We need set `process.env.PORT` to our PORT variable to use Heroku PORT. Then add 8080 as a fallback port for our localhost development 46 | 47 | We should end up with something like this 48 | ![PORT Images](public/images/port.png); 49 | 50 | 51 | #### Step 2 52 | > `server.js` 53 | 54 | Heroku's going to generate an environment variable called `MONGODB_URI` for us to connect to mlab (MongoDB). In order to utilize this variable, we need to set our `mongoose.connect` with that variable. 55 | 56 | It should look like this 57 | ![MONGODB_URI](public/images/mongodb_uri.png); 58 | 59 | 60 | #### Step 3 61 | > `server.js` 62 | 63 | Once our app is on Heroku, we need to send the static build files on our server so that Heroku can serve it. 64 | 65 | How do we know our app is on Heroku? 66 | Well, by default Heroku has this environment variable called `NODE_ENV` with a value set to production. We can write a conditional logic to check if `NODE_ENV` has the value of production, if so, then we know for sure that our app is on Heroku. Then we serve the static files generated by React after we have successfully ran `npm run build` in the client folder. 67 | 68 | We should end up having something like this 69 | ![Node Env](public/images/node_env.png); 70 | 71 | 72 | 73 | #### Step 4 74 | > `package.json` 75 | 76 | You don't want to always keep doing `npm run build` to generate the build folder for you every time you do a change. What if Heroku can do it for us? Well, the good news is, yes it can :) 77 | 78 | Heroku has 2 builds scripts that you can run either before or after the build. 79 | 80 | - heroku-prebuild 81 | 82 | - heroku-postbuild 83 | 84 | We're going to use the `heroku-postbuild` one. This is a change that we need to do inside the package.json, under the scripts section. 85 | 86 | It should look like this 87 | ![Heroku Post Build](public/images/heroku-postbuild.png); 88 | 89 | 90 | > Note: In order to run step 5, you need to make sure you already have `git` initialized into your project. A quickly way to check, is by doing `git status` in your terminal. If you see the following message `fatal: Not a git repository` . That means you do not have git initialized into your project. You can run `git init` to initialized git and continue to step 5 91 | 92 | 93 | 94 | #### Step 5 95 | > `open your terminal` 96 | 97 | Once we have the above steps completed, we can run the following commands to create a heroku app, configure mlab, and push our code to heroku 98 | 99 | 100 | ``` 101 | $ heroku create app_name 102 | 103 | $ heroku addons:create mongolab:sandbox 104 | 105 | $ git add -A 106 | 107 | $ git commit -m "add_message" 108 | 109 | $ git push heroku master 110 | 111 | $ heroku open 112 | 113 | ``` -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production build 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@material-ui/core": "^3.9.2", 7 | "react": "^16.8.2", 8 | "react-dom": "^16.8.2", 9 | "react-scripts": "2.1.5" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build", 14 | "test": "react-scripts test", 15 | "eject": "react-scripts eject" 16 | }, 17 | "eslintConfig": { 18 | "extends": "react-app" 19 | }, 20 | "browserslist": [ 21 | ">0.2%", 22 | "not dead", 23 | "not ie <= 11", 24 | "not op_mini all" 25 | ], 26 | "proxy": "http://localhost:8080" 27 | } 28 | -------------------------------------------------------------------------------- /client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/client/public/favicon.ico -------------------------------------------------------------------------------- /client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 15 | 16 | 25 | Company Employee List 26 | 27 | 28 | 29 |
30 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /client/src/App.css: -------------------------------------------------------------------------------- 1 | 2 | .form, .users { 3 | margin: 0px auto; 4 | width: 50%; 5 | } 6 | 7 | .form { 8 | display: flex; 9 | justify-content: center; 10 | align-content: center; 11 | flex-direction: column; 12 | } 13 | 14 | .form > div { 15 | margin-top: 10px; 16 | } 17 | .form button { 18 | margin-top: 20px; 19 | width: 100px; 20 | } -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Form from './components/Form'; 3 | import DisplayUsers from './components/DisplayUsers'; 4 | import axios from 'axios'; 5 | import './App.css'; 6 | class App extends Component { 7 | state = { 8 | users: [] 9 | } 10 | 11 | componentDidMount = () => { 12 | this.fetchUsers(); 13 | }; 14 | 15 | fetchUsers = () => { 16 | axios.get('/users') 17 | .then((response) => { 18 | const { users } = response.data; 19 | this.setState({ users: [...this.state.users, ...users] }) 20 | }) 21 | .catch(() => alert('Error fetching new users')); 22 | }; 23 | 24 | 25 | addUser = ({ name, position, company }) => { 26 | this.setState({ 27 | users: [...this.state.users, { name, position, company }] 28 | }); 29 | }; 30 | 31 | render() { 32 | return ( 33 |
34 |
35 | < DisplayUsers users={this.state.users} /> 36 | 37 |
38 | ); 39 | } 40 | } 41 | 42 | export default App; 43 | -------------------------------------------------------------------------------- /client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /client/src/components/DisplayUsers.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Table, TableBody, TableCell, TableHead, TableRow } from '@material-ui/core'; 3 | 4 | const { isEmpty } = require('lodash'); 5 | 6 | 7 | 8 | class DisplayUser extends Component { 9 | render() { 10 | const allUsers = this.props.users; 11 | const users = !isEmpty(allUsers) ? allUsers : []; 12 | 13 | return ( 14 |
15 | {!isEmpty(users) ? 16 | 17 | 18 | Name 19 | Company 20 | Position 21 | 22 | 23 | 24 | {users.map(({ name, position, company }, key) => ( 25 | 26 | {name ? name : 'No Name Found'} 27 | {company ? company : 'No Company Found'} 28 | {position ? position : 'No Position Found'} 29 | 30 | ))} 31 | 32 |
: null} 33 |
34 | ); 35 | } 36 | } 37 | 38 | export default DisplayUser; 39 | -------------------------------------------------------------------------------- /client/src/components/Form.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { TextField, Button } from '@material-ui/core'; 3 | import axios from 'axios'; 4 | 5 | class Form extends Component { 6 | state = { 7 | name: '', 8 | position: '', 9 | company: '' 10 | }; 11 | 12 | handleChange = e => { 13 | const name = e.target.name; 14 | const value = e.target.value; 15 | this.setState({ [name]: value }); 16 | }; 17 | 18 | submit = e => { 19 | e.preventDefault(); 20 | const { name, position, company } = this.state; 21 | axios({ 22 | url: '/add', 23 | method: 'POST', 24 | data: { 25 | name, 26 | position, 27 | company 28 | } 29 | }) 30 | .then((response) => { 31 | this.props.addUser(response.data); 32 | this.setState({ 33 | name: '', 34 | company: '', 35 | position: '' 36 | }); 37 | }) 38 | .catch(() => alert('Failed uploading data')) 39 | }; 40 | render() { 41 | return ( 42 | 43 |

Please, Tell us about you

44 | 51 | 52 | 59 | 60 | 67 | 68 | 69 | 70 | 71 | ); 72 | } 73 | } 74 | 75 | export default Form; 76 | -------------------------------------------------------------------------------- /client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 5 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 6 | sans-serif; 7 | -webkit-font-smoothing: antialiased; 8 | -moz-osx-font-smoothing: grayscale; 9 | } 10 | 11 | code { 12 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 13 | monospace; 14 | } 15 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: http://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /client/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /client/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read http://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit http://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See http://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /models/user.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const Schema = mongoose.Schema; 3 | 4 | const UserSchema = new Schema({ 5 | position: String, 6 | name: String, 7 | company: String, 8 | date: Date 9 | }); 10 | 11 | const User = mongoose.model('User', UserSchema); 12 | 13 | 14 | module.exports = User; -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mernapp", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.5", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", 10 | "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", 11 | "requires": { 12 | "mime-types": "~2.1.18", 13 | "negotiator": "0.6.1" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "async": { 22 | "version": "2.6.1", 23 | "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", 24 | "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", 25 | "requires": { 26 | "lodash": "^4.17.10" 27 | } 28 | }, 29 | "axios": { 30 | "version": "0.18.0", 31 | "resolved": "https://registry.npmjs.org/axios/-/axios-0.18.0.tgz", 32 | "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", 33 | "requires": { 34 | "follow-redirects": "^1.3.0", 35 | "is-buffer": "^1.1.5" 36 | } 37 | }, 38 | "bluebird": { 39 | "version": "3.5.1", 40 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", 41 | "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" 42 | }, 43 | "body-parser": { 44 | "version": "1.18.3", 45 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", 46 | "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", 47 | "requires": { 48 | "bytes": "3.0.0", 49 | "content-type": "~1.0.4", 50 | "debug": "2.6.9", 51 | "depd": "~1.1.2", 52 | "http-errors": "~1.6.3", 53 | "iconv-lite": "0.4.23", 54 | "on-finished": "~2.3.0", 55 | "qs": "6.5.2", 56 | "raw-body": "2.3.3", 57 | "type-is": "~1.6.16" 58 | }, 59 | "dependencies": { 60 | "debug": { 61 | "version": "2.6.9", 62 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 63 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 64 | "requires": { 65 | "ms": "2.0.0" 66 | } 67 | }, 68 | "ms": { 69 | "version": "2.0.0", 70 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 71 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 72 | } 73 | } 74 | }, 75 | "bson": { 76 | "version": "1.1.0", 77 | "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", 78 | "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" 79 | }, 80 | "bytes": { 81 | "version": "3.0.0", 82 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", 83 | "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" 84 | }, 85 | "content-disposition": { 86 | "version": "0.5.2", 87 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", 88 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" 89 | }, 90 | "content-type": { 91 | "version": "1.0.4", 92 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 93 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 94 | }, 95 | "cookie": { 96 | "version": "0.3.1", 97 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", 98 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" 99 | }, 100 | "cookie-signature": { 101 | "version": "1.0.6", 102 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 103 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 104 | }, 105 | "debug": { 106 | "version": "3.2.6", 107 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", 108 | "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", 109 | "requires": { 110 | "ms": "^2.1.1" 111 | } 112 | }, 113 | "depd": { 114 | "version": "1.1.2", 115 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 116 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 117 | }, 118 | "destroy": { 119 | "version": "1.0.4", 120 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 121 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 122 | }, 123 | "ee-first": { 124 | "version": "1.1.1", 125 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 126 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 127 | }, 128 | "encodeurl": { 129 | "version": "1.0.2", 130 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 131 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 132 | }, 133 | "escape-html": { 134 | "version": "1.0.3", 135 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 136 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 137 | }, 138 | "etag": { 139 | "version": "1.8.1", 140 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 141 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 142 | }, 143 | "express": { 144 | "version": "4.16.4", 145 | "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", 146 | "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", 147 | "requires": { 148 | "accepts": "~1.3.5", 149 | "array-flatten": "1.1.1", 150 | "body-parser": "1.18.3", 151 | "content-disposition": "0.5.2", 152 | "content-type": "~1.0.4", 153 | "cookie": "0.3.1", 154 | "cookie-signature": "1.0.6", 155 | "debug": "2.6.9", 156 | "depd": "~1.1.2", 157 | "encodeurl": "~1.0.2", 158 | "escape-html": "~1.0.3", 159 | "etag": "~1.8.1", 160 | "finalhandler": "1.1.1", 161 | "fresh": "0.5.2", 162 | "merge-descriptors": "1.0.1", 163 | "methods": "~1.1.2", 164 | "on-finished": "~2.3.0", 165 | "parseurl": "~1.3.2", 166 | "path-to-regexp": "0.1.7", 167 | "proxy-addr": "~2.0.4", 168 | "qs": "6.5.2", 169 | "range-parser": "~1.2.0", 170 | "safe-buffer": "5.1.2", 171 | "send": "0.16.2", 172 | "serve-static": "1.13.2", 173 | "setprototypeof": "1.1.0", 174 | "statuses": "~1.4.0", 175 | "type-is": "~1.6.16", 176 | "utils-merge": "1.0.1", 177 | "vary": "~1.1.2" 178 | }, 179 | "dependencies": { 180 | "debug": { 181 | "version": "2.6.9", 182 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 183 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 184 | "requires": { 185 | "ms": "2.0.0" 186 | } 187 | }, 188 | "ms": { 189 | "version": "2.0.0", 190 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 191 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 192 | }, 193 | "statuses": { 194 | "version": "1.4.0", 195 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 196 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 197 | } 198 | } 199 | }, 200 | "finalhandler": { 201 | "version": "1.1.1", 202 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", 203 | "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", 204 | "requires": { 205 | "debug": "2.6.9", 206 | "encodeurl": "~1.0.2", 207 | "escape-html": "~1.0.3", 208 | "on-finished": "~2.3.0", 209 | "parseurl": "~1.3.2", 210 | "statuses": "~1.4.0", 211 | "unpipe": "~1.0.0" 212 | }, 213 | "dependencies": { 214 | "debug": { 215 | "version": "2.6.9", 216 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 217 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 218 | "requires": { 219 | "ms": "2.0.0" 220 | } 221 | }, 222 | "ms": { 223 | "version": "2.0.0", 224 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 225 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 226 | }, 227 | "statuses": { 228 | "version": "1.4.0", 229 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 230 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 231 | } 232 | } 233 | }, 234 | "follow-redirects": { 235 | "version": "1.7.0", 236 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", 237 | "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", 238 | "requires": { 239 | "debug": "^3.2.6" 240 | } 241 | }, 242 | "forwarded": { 243 | "version": "0.1.2", 244 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 245 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 246 | }, 247 | "fresh": { 248 | "version": "0.5.2", 249 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 250 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 251 | }, 252 | "http-errors": { 253 | "version": "1.6.3", 254 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", 255 | "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", 256 | "requires": { 257 | "depd": "~1.1.2", 258 | "inherits": "2.0.3", 259 | "setprototypeof": "1.1.0", 260 | "statuses": ">= 1.4.0 < 2" 261 | } 262 | }, 263 | "iconv-lite": { 264 | "version": "0.4.23", 265 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", 266 | "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", 267 | "requires": { 268 | "safer-buffer": ">= 2.1.2 < 3" 269 | } 270 | }, 271 | "inherits": { 272 | "version": "2.0.3", 273 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 274 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 275 | }, 276 | "ipaddr.js": { 277 | "version": "1.8.0", 278 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", 279 | "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" 280 | }, 281 | "is-buffer": { 282 | "version": "1.1.6", 283 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", 284 | "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" 285 | }, 286 | "js-tokens": { 287 | "version": "4.0.0", 288 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", 289 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" 290 | }, 291 | "kareem": { 292 | "version": "2.3.0", 293 | "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz", 294 | "integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg==" 295 | }, 296 | "lodash": { 297 | "version": "4.17.11", 298 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", 299 | "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" 300 | }, 301 | "loose-envify": { 302 | "version": "1.4.0", 303 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", 304 | "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", 305 | "requires": { 306 | "js-tokens": "^3.0.0 || ^4.0.0" 307 | } 308 | }, 309 | "media-typer": { 310 | "version": "0.3.0", 311 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 312 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 313 | }, 314 | "memory-pager": { 315 | "version": "1.5.0", 316 | "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", 317 | "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", 318 | "optional": true 319 | }, 320 | "merge-descriptors": { 321 | "version": "1.0.1", 322 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 323 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 324 | }, 325 | "methods": { 326 | "version": "1.1.2", 327 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 328 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 329 | }, 330 | "mime": { 331 | "version": "1.4.1", 332 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", 333 | "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" 334 | }, 335 | "mime-db": { 336 | "version": "1.38.0", 337 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.38.0.tgz", 338 | "integrity": "sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg==" 339 | }, 340 | "mime-types": { 341 | "version": "2.1.22", 342 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.22.tgz", 343 | "integrity": "sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog==", 344 | "requires": { 345 | "mime-db": "~1.38.0" 346 | } 347 | }, 348 | "mongodb": { 349 | "version": "3.1.13", 350 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.13.tgz", 351 | "integrity": "sha512-sz2dhvBZQWf3LRNDhbd30KHVzdjZx9IKC0L+kSZ/gzYquCF5zPOgGqRz6sSCqYZtKP2ekB4nfLxhGtzGHnIKxA==", 352 | "requires": { 353 | "mongodb-core": "3.1.11", 354 | "safe-buffer": "^5.1.2" 355 | } 356 | }, 357 | "mongodb-core": { 358 | "version": "3.1.11", 359 | "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.11.tgz", 360 | "integrity": "sha512-rD2US2s5qk/ckbiiGFHeu+yKYDXdJ1G87F6CG3YdaZpzdOm5zpoAZd/EKbPmFO6cQZ+XVXBXBJ660sSI0gc6qg==", 361 | "requires": { 362 | "bson": "^1.1.0", 363 | "require_optional": "^1.0.1", 364 | "safe-buffer": "^5.1.2", 365 | "saslprep": "^1.0.0" 366 | } 367 | }, 368 | "mongoose": { 369 | "version": "5.4.13", 370 | "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.4.13.tgz", 371 | "integrity": "sha512-4dgmFbtNECbW3ZMS6ha2pebinUzZo789scdccdyyajbmaunBPqZJqp6eO6pThIqDsgSOkRi4IrzkZm8kmhtZMA==", 372 | "requires": { 373 | "async": "2.6.1", 374 | "bson": "~1.1.0", 375 | "kareem": "2.3.0", 376 | "mongodb": "3.1.13", 377 | "mongodb-core": "3.1.11", 378 | "mongoose-legacy-pluralize": "1.0.2", 379 | "mpath": "0.5.1", 380 | "mquery": "3.2.0", 381 | "ms": "2.1.1", 382 | "regexp-clone": "0.0.1", 383 | "safe-buffer": "5.1.2", 384 | "sliced": "1.0.1" 385 | } 386 | }, 387 | "mongoose-legacy-pluralize": { 388 | "version": "1.0.2", 389 | "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", 390 | "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" 391 | }, 392 | "mpath": { 393 | "version": "0.5.1", 394 | "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz", 395 | "integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==" 396 | }, 397 | "mquery": { 398 | "version": "3.2.0", 399 | "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.0.tgz", 400 | "integrity": "sha512-qPJcdK/yqcbQiKoemAt62Y0BAc0fTEKo1IThodBD+O5meQRJT/2HSe5QpBNwaa4CjskoGrYWsEyjkqgiE0qjhg==", 401 | "requires": { 402 | "bluebird": "3.5.1", 403 | "debug": "3.1.0", 404 | "regexp-clone": "0.0.1", 405 | "safe-buffer": "5.1.2", 406 | "sliced": "1.0.1" 407 | }, 408 | "dependencies": { 409 | "debug": { 410 | "version": "3.1.0", 411 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 412 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 413 | "requires": { 414 | "ms": "2.0.0" 415 | } 416 | }, 417 | "ms": { 418 | "version": "2.0.0", 419 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 420 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 421 | } 422 | } 423 | }, 424 | "ms": { 425 | "version": "2.1.1", 426 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 427 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 428 | }, 429 | "negotiator": { 430 | "version": "0.6.1", 431 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", 432 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" 433 | }, 434 | "object-assign": { 435 | "version": "4.1.1", 436 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 437 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 438 | }, 439 | "on-finished": { 440 | "version": "2.3.0", 441 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 442 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 443 | "requires": { 444 | "ee-first": "1.1.1" 445 | } 446 | }, 447 | "parseurl": { 448 | "version": "1.3.2", 449 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", 450 | "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" 451 | }, 452 | "path-to-regexp": { 453 | "version": "0.1.7", 454 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 455 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 456 | }, 457 | "prop-types": { 458 | "version": "15.7.2", 459 | "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", 460 | "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", 461 | "requires": { 462 | "loose-envify": "^1.4.0", 463 | "object-assign": "^4.1.1", 464 | "react-is": "^16.8.1" 465 | } 466 | }, 467 | "proxy-addr": { 468 | "version": "2.0.4", 469 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", 470 | "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", 471 | "requires": { 472 | "forwarded": "~0.1.2", 473 | "ipaddr.js": "1.8.0" 474 | } 475 | }, 476 | "qs": { 477 | "version": "6.5.2", 478 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 479 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 480 | }, 481 | "range-parser": { 482 | "version": "1.2.0", 483 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", 484 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" 485 | }, 486 | "raw-body": { 487 | "version": "2.3.3", 488 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", 489 | "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", 490 | "requires": { 491 | "bytes": "3.0.0", 492 | "http-errors": "1.6.3", 493 | "iconv-lite": "0.4.23", 494 | "unpipe": "1.0.0" 495 | } 496 | }, 497 | "react-is": { 498 | "version": "16.8.2", 499 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.8.2.tgz", 500 | "integrity": "sha512-D+NxhSR2HUCjYky1q1DwpNUD44cDpUXzSmmFyC3ug1bClcU/iDNy0YNn1iwme28fn+NFhpA13IndOd42CrFb+Q==" 501 | }, 502 | "regexp-clone": { 503 | "version": "0.0.1", 504 | "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", 505 | "integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" 506 | }, 507 | "require_optional": { 508 | "version": "1.0.1", 509 | "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", 510 | "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", 511 | "requires": { 512 | "resolve-from": "^2.0.0", 513 | "semver": "^5.1.0" 514 | } 515 | }, 516 | "resolve-from": { 517 | "version": "2.0.0", 518 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 519 | "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" 520 | }, 521 | "safe-buffer": { 522 | "version": "5.1.2", 523 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 524 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 525 | }, 526 | "safer-buffer": { 527 | "version": "2.1.2", 528 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 529 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 530 | }, 531 | "saslprep": { 532 | "version": "1.0.2", 533 | "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.2.tgz", 534 | "integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==", 535 | "optional": true, 536 | "requires": { 537 | "sparse-bitfield": "^3.0.3" 538 | } 539 | }, 540 | "semver": { 541 | "version": "5.6.0", 542 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", 543 | "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" 544 | }, 545 | "send": { 546 | "version": "0.16.2", 547 | "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", 548 | "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", 549 | "requires": { 550 | "debug": "2.6.9", 551 | "depd": "~1.1.2", 552 | "destroy": "~1.0.4", 553 | "encodeurl": "~1.0.2", 554 | "escape-html": "~1.0.3", 555 | "etag": "~1.8.1", 556 | "fresh": "0.5.2", 557 | "http-errors": "~1.6.2", 558 | "mime": "1.4.1", 559 | "ms": "2.0.0", 560 | "on-finished": "~2.3.0", 561 | "range-parser": "~1.2.0", 562 | "statuses": "~1.4.0" 563 | }, 564 | "dependencies": { 565 | "debug": { 566 | "version": "2.6.9", 567 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 568 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 569 | "requires": { 570 | "ms": "2.0.0" 571 | } 572 | }, 573 | "ms": { 574 | "version": "2.0.0", 575 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 576 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 577 | }, 578 | "statuses": { 579 | "version": "1.4.0", 580 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", 581 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" 582 | } 583 | } 584 | }, 585 | "serve-static": { 586 | "version": "1.13.2", 587 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", 588 | "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", 589 | "requires": { 590 | "encodeurl": "~1.0.2", 591 | "escape-html": "~1.0.3", 592 | "parseurl": "~1.3.2", 593 | "send": "0.16.2" 594 | } 595 | }, 596 | "setprototypeof": { 597 | "version": "1.1.0", 598 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", 599 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" 600 | }, 601 | "sliced": { 602 | "version": "1.0.1", 603 | "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", 604 | "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" 605 | }, 606 | "sparse-bitfield": { 607 | "version": "3.0.3", 608 | "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", 609 | "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", 610 | "optional": true, 611 | "requires": { 612 | "memory-pager": "^1.0.2" 613 | } 614 | }, 615 | "statuses": { 616 | "version": "1.5.0", 617 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 618 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 619 | }, 620 | "type-is": { 621 | "version": "1.6.16", 622 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", 623 | "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", 624 | "requires": { 625 | "media-typer": "0.3.0", 626 | "mime-types": "~2.1.18" 627 | } 628 | }, 629 | "unpipe": { 630 | "version": "1.0.0", 631 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 632 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 633 | }, 634 | "utils-merge": { 635 | "version": "1.0.1", 636 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 637 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 638 | }, 639 | "vary": { 640 | "version": "1.1.2", 641 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 642 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 643 | } 644 | } 645 | } 646 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mernapp", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js", 9 | "heroku-postbuild": "cd client && npm install && npm run build" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "axios": "^0.18.0", 16 | "body-parser": "^1.18.3", 17 | "express": "^4.16.4", 18 | "lodash": "^4.17.11", 19 | "mongoose": "^5.4.13", 20 | "prop-types": "^15.7.2" 21 | }, 22 | "engines": { 23 | "node": "11.3.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/images/engines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/public/images/engines.png -------------------------------------------------------------------------------- /public/images/heroku-postbuild.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/public/images/heroku-postbuild.png -------------------------------------------------------------------------------- /public/images/mongodb_uri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/public/images/mongodb_uri.png -------------------------------------------------------------------------------- /public/images/node_env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/public/images/node_env.png -------------------------------------------------------------------------------- /public/images/port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/accimeesterlin/mern-stack-deploy-heroku/0b9226d7e7e27eb6eae264791a89417e89fadc24/public/images/port.png -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { isEmpty } = require('lodash'); 3 | const User = require('../models/user'); 4 | const router = express.Router(); 5 | 6 | router.post('/add', async (req, res) => { 7 | if (isEmpty(req.body)) { 8 | return res.status(403).json({ 9 | message: 'Body should not be empty', 10 | statusCode: 403 11 | }); 12 | } 13 | const { name, position, company } = req.body; 14 | 15 | const newUser = new User({ 16 | position, 17 | name, 18 | company, 19 | date: Date.now() 20 | }); 21 | try { 22 | await newUser.save(); 23 | res.json({ 24 | message: 'Data successfully saved', 25 | statusCode: 200, 26 | name, 27 | position, 28 | company 29 | }); 30 | } catch (error) { 31 | console.log('Error: ', error); 32 | res.status(500).json({ 33 | message: 'Internal Server error', 34 | statusCode: 500 35 | }); 36 | } 37 | }); 38 | 39 | 40 | router.get('/users', async (req, res) => { 41 | 42 | try { 43 | const users = await User.find({}); 44 | 45 | return res.json({ 46 | users 47 | }); 48 | } catch (error) { 49 | return res.status(500).json({ 50 | message: 'Internal Server error' 51 | }); 52 | } 53 | 54 | }); 55 | 56 | module.exports = router; -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | 2 | // Importing Modules 3 | const mongoose = require('mongoose'); 4 | const express = require('express'); 5 | const bodyParser = require('body-parser'); 6 | const path = require('path'); 7 | 8 | // importing files 9 | const routes = require('./routes'); 10 | 11 | // Define Global Variables 12 | const app = express(); 13 | const log = console.log; 14 | const PORT = process.env.PORT || 8080; // Step 1 15 | 16 | 17 | // Step 2 18 | mongoose.connect( process.env.MONGODB_URI || 'mongodb://localhost/my_database', { 19 | useNewUrlParser: true 20 | }); 21 | 22 | // Configuration 23 | app.use(bodyParser.json()); 24 | app.use(bodyParser.urlencoded({ extended: false })); 25 | app.use('/', routes); 26 | 27 | // Step 3 28 | if (process.env.NODE_ENV === 'production') { 29 | app.use(express.static( 'client/build' )); 30 | 31 | app.get('*', (req, res) => { 32 | res.sendFile(path.join(__dirname, 'client', 'build', 'index.html')); // relative path 33 | }); 34 | } 35 | 36 | app.listen(PORT, () => { 37 | log(`Server is starting at PORT: ${PORT}`); 38 | }); --------------------------------------------------------------------------------