An open API service indexing awesome lists of open source software.

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!

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


Profile Picture

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

[![license](https://img.shields.io/badge/license-MIT-green)](https://simonanewton.mit-license.org)

MIT License © Simon Newton