Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/skx1322/blog-web

URL OPENED
https://github.com/skx1322/blog-web

ejs nodejs psotgresql

Last synced: 6 days ago
JSON representation

URL OPENED

Awesome Lists containing this project

README

        

# BlogEJS
This Project mainly utilize Node.js, Express and EJS and various Node Package Module libraries.

# Issue
Render doesn't provide me a disk or file system so Image that were uploaded to it are not saved

# 1. Node.js and Terminal Install
- Make sure you're using the Node.js version at least 20.18.0
--> https://nodejs.org/en
- Make sure you also have Terminal environment such as Git Bash.
--> https://git-scm.com/downloads
- Ensure you have Google Authentification Client ID setup in Google Cloud Project
--> https://developers.google.com/identity/sign-in/web/sign-in

# 2. Set up NPM
- This step is to install the Node.js 3rd party libraries.
- For this Project, I used the following libraries:
1. bcrypt
2. body-parser
3. dotenv
4. ejs
5. express
6. express-session
7. multer
8. nodemon (Optional)
9. passport
10. passport-google-oauth2
11. passport-local
12. pg (PostgreSQL Database)

```bash
npm install
```

```bash
# If the package didn't install the libraries
npm i bcrypt body-paser dotenv ejs express express-session multer passport passport-google-oauth2 passport-local pg
npm i nodemon # Optional
```

- It'll automatically install all the libraries according to the JSON.

# 3. Step up the an .env while and fill in the root.
- Ensure you have PostgreSQL PG-ADMIN 4 opened in your local environment
- And you can set up GOOGLE SECURITY in Google Cloud by starting a new project
```bash
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
SESSION_SECRET=your-session-secret
PG_USER=your-postgres-username
PG_HOST=localhost
PG_DATABASE=mydatabase
PG_PASSWORD=your-postgres-password
PG_PORT=5432
```

# 4. Once all the following step is done, do the following in terminal
```bash
nodemon index.js
```
(If 'nodemon index.js doesn't work, use the following)

```bash
npx nodemon index.js
```