https://github.com/coder12git/simple-blog-website-mongodb-version
https://github.com/coder12git/simple-blog-website-mongodb-version
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/coder12git/simple-blog-website-mongodb-version
- Owner: coder12git
- Created: 2022-08-15T16:27:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-15T19:20:52.000Z (almost 3 years ago)
- Last Synced: 2025-01-01T07:07:30.643Z (5 months ago)
- Language: JavaScript
- Size: 538 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple-Blog-MongoDB version
This is an exercise in [Node.js](https://nodejs.org/en/), [Express.js](https://expressjs.com/), [MongoDB](https://www.mongodb.com/), and [Mongoose](https://mongoosejs.com/). It's a simple blogging web application where one can **add new blog posts**, **view them** in their own dedicated route, and **delete or edit them**. The posts are stored in a local MongoDB database. [EJS templating](https://ejs.co/) is used for the HTML pages, [Bootstrap v5.2](https://getbootstrap.com/docs/5.2/getting-started/introduction/) is also used, along with some custom CSS styling.
It's basically a backend database.



---
## To run the app:
### Prerequisites
In order to run this application locally you'll need to have [Node.js](https://nodejs.org/en/) installed in your system, as well as [MongoDB](https://www.mongodb.com/).
### Running the app locally
Once you **clone or download** the repository files to your desired location, open a command-line terminal, navigate into the app top-level directory, and **install the required package dependencies**.
```bash
$ cd Simple-Blog-website # or your chosen other directory name
$ npm install # install package dependencies
```Then open two command-line terminals, one to **run the `mongod` process** and the other to **run `mongod`** (so that you can verify the post additions - see below):
```bash
# CLI tab 1
$ mongod# CLI tab 2
$ mongo
```Finally, start the app by running the '[app.js](./app.js)' file:
```bash
$ node app.js # or 'nodemon app.js', etc
```and type "[http://localhost:3000](http://localhost:3000)" in your browser's address to see the application running.
### Verifying changes via 'mongo'
Once you've added some posts to the blog (and thus the database), they can be verified by going to the `mongo` CLI tab:
```bash
> show dbs # there should be a 'postsDB' present
> use postsDB
> show collections # there should be a 'posts' collection
> db.posts.find() # show all post documents in the 'posts' collection> cls # clears the screen
> exit # exits the mongo session
```Don't forget to ***also terminate the 'mongod' process*** via Ctrl+C before closing that tab!
---
Click on this [link](https://fathomless-stream-66385.herokuapp.com/) too see my website!
---
Random funny short:
- "Debugging: being the detective in a crime movie where you're also the murderer".