Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/madhums/node-express-mongoose
A boilerplate application for building web apps using node and mongodb
https://github.com/madhums/node-express-mongoose
boilerplate express mongoose node nodejs passport
Last synced: about 1 month ago
JSON representation
A boilerplate application for building web apps using node and mongodb
- Host: GitHub
- URL: https://github.com/madhums/node-express-mongoose
- Owner: madhums
- License: mit
- Created: 2013-06-22T09:37:38.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-09-21T10:34:12.000Z (about 2 months ago)
- Last Synced: 2024-09-28T12:40:15.013Z (about 1 month ago)
- Topics: boilerplate, express, mongoose, node, nodejs, passport
- Language: JavaScript
- Homepage:
- Size: 1.32 MB
- Stars: 1,425
- Watchers: 43
- Forks: 383
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
[![tests](https://github.com/madhums/node-express-mongoose/actions/workflows/test.yml/badge.svg)](https://github.com/madhums/node-express-mongoose/actions/workflows/test.yml)
[![Code Climate](https://codeclimate.com/github/codeclimate/codeclimate/badges/gpa.svg)](https://codeclimate.com/github/madhums/node-express-mongoose)## Node Express Mongoose
A boilerplate application for building web apps using express, mongoose and passport.
Read the [wiki](https://github.com/madhums/node-express-mongoose/wiki) to understand how the application is structured.
## Usage
git clone https://github.com/madhums/node-express-mongoose.git
cd node-express-mongoose
npm install
cp .env.example .env
npm startCheckout the [apps that are built using this approach](https://github.com/madhums/node-express-mongoose/wiki/Apps-built-using-this-approach)
## Docker
You can also use docker for development. Make sure you run npm install on your host machine so that code linting and everything works fine.
```sh
npm i
cp .env.example .env
```Start the services
```sh
docker-compose up -d
```View the logs
```sh
docker-compose logs -f
```In case you install a npm module while developing, it should also be installed within docker container, to do this first install the module you want with simple `npm i module name`, then run it within docker container
```sh
docker-compose exec node npm i
```If you make any changes to the file, nodemon should automatically pick up and restart within docker (you can see this in the logs)
To run tests
```sh
docker-compose exec -e MONGODB_URL=mongodb://mongo:27017/noobjs_test node npm test
```Note that we are overriding the environment variable set in `.env` file because we don't want our data erased by the tests.
Note: The difference between exec and run is that, exec executes the command within the running container and run will spin up a new container to run that command. So if you want to run only the tests without docker-compose up, you may do so by running `docker-compose run -e MONGODB_URL=mongodb://mongo:27017/my_app_test node npm test`
## Deployment
If you want to deploy to heroku, you can follow [this article](https://devcenter.heroku.com/articles/deploying-nodejs)
## License
MIT