https://github.com/simonanewton/mern-template
MERN Stack Application Template. Please feel free to use, modify, and replace anything you'd like. No credit required. Have fun!
https://github.com/simonanewton/mern-template
expressjs mern mern-stack mongoose nodejs react template
Last synced: 3 months ago
JSON representation
MERN Stack Application Template. Please feel free to use, modify, and replace anything you'd like. No credit required. Have fun!
- Host: GitHub
- URL: https://github.com/simonanewton/mern-template
- Owner: simonanewton
- License: mit
- Created: 2020-08-09T06:16:07.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T02:54:50.000Z (over 2 years ago)
- Last Synced: 2023-03-05T10:11:28.887Z (about 2 years ago)
- Topics: expressjs, mern, mern-stack, mongoose, nodejs, react, template
- Language: JavaScript
- Homepage:
- Size: 6.14 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MERN Stack Template
## Description
This respository is a [MERN Stack](https://www.mongodb.com/mern-stack) Application template. It is open to use for anyone who wants to quickly get started building a [full-stack](https://www.geeksforgeeks.org/what-is-full-stack-development/) web application with a [MongoDB](https://www.geeksforgeeks.org/what-is-mongodb-working-and-features/) database. To start, make sure you use this repository as a template instead of simply cloning it, as this will ensure you create a new repository with a fresh commit history for your new project. After that, simply replace your personal information and project details in the appropriate locations and start building your application! This template is still a work in progress and will continue to be updated with new [npm package](https://www.w3schools.com/whatis/whatis_npm.asp) versions and syntax as needed. If you have any ideas, suggestions, or conerns about the template, feel free to submit a [pull request](https://github.com/simonanewton/mern-template/pulls) on GitHub.
## Table of Contents
* [Description](#description)
* [Express Server](#express-server)
* [Installation](#installation)
* [Usage](#usage)
* [Contributing](#contributing)
* [Credits](#credits)
* [License](#license)## Express Server
```js
const PORT = process.env.PORT || 3001;
const MONGODB_URI = "mongodb://localhost/mern-template";const app = express();
app.use(cors());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());if (process.env.NODE_ENV === "production") app.use(express.static("./client/build"));
mongoose.connect(process.env.MONGODB_URI || MONGODB_URI, { useUnifiedTopology: true, useNewUrlParser: true },
(err) => {
console.log("Connected to MongoDB database");
if (err) throw err;
});app.use(routes);
app.listen(PORT, () => console.log(`Server is listening on http://localhost:${PORT}`));
```## Installation
To install the npm packages required to run this application, execute the following command:
```sh
npm install
```## Usage
To run this application, execute the following command:
```sh
npm start
```## Contributing
![]()
Simon Newton
Hey, I'm Simon and I'm a Junior Full-Stack Web Developer!
GitHub Profile | LinkedIn Profile | Portfolio Website | Developer Blog## Credits
NPM Packages
* https://www.npmjs.com/package/express
* https://www.npmjs.com/package/mongoose
* https://www.npmjs.com/package/react
* https://www.npmjs.com/package/react-bootstrap## License
[](https://simonanewton.mit-license.org)
MIT License © Simon Newton