Skip to content

oscmedgon/hod_final_project

Repository files navigation

HoD News page about gaming

Standard - JavaScript Style Guide

Skylab

Backend technologies

npm NodeJS ExpressJS Passport MongoDB PugJS HTML5,CSS3 and JS ES6

Frontend technologies

HTML5,CSS3 and JS ES6 Reactjs

Pre-requisites and how to install it

IMPORTANT! for every test you can use my test administrator

You need to have installed NodeJS with npm and MongoDB

Super Secure in a production build remove this user
username: 1
password: 1

The first step if you want to use this project it's create a mongo database you can do it online !Mlab, it's free. Then you have to import my test database located in the project folder /prerequisites you can do it with this command (You have to import collections one by one there is not a magical command to do it):

mongoimport -h <YOUR-DB-URL>.mlab.com:<YOUR-DB-PORT> -d <YOUR-DB-NAME> -c <DB-COLLECTION(users & articles)> -u <YOUR-DB-USER> -p <YOUR-DB-PASSWORD> --file <PATH-TO-/-INPUT-FILE.json>

You did it, now configure enviroment create a new file in the project root called .env it musth have all the following lines (Modify them to match with your needs):

URL_DB=mongodb://<YOUR-DB-USER>:<YOUR-DB-PASSWORD>@ds<YOUR-DB-URL>.mlab.com:<YOUR-DB-PORT>/YOUR-DB-NAME
SECRET=<YOUR-SUPER-SECRET>
UPLOAD_FOLDER=uploads
#
# THE FOLLOWING SECTION IT'S TO CONFIGURE CLOUDINARY TO STORAGE ALL IMAGE UPLOADS CREATE AN ACOUNT BEFORE CONTINUE
#
CLOUD_NAME=<YOUR-CLOUD-NAME>
API_KEY=<YOUR-API-KEY>
API_SECRET=<YOUR-API-SECRET>

If you are reading this..., You rules.

You are ready to get started, just run this command at your project root(I'm not going to hack your computer or anything like that, just install node dependencies and run server in developement state):

npm run superStart
.then(return 'Open your brouser and go to http://localhost:8080')

Now you have your server runing and working, if not mail me or leave me a comment. if you want to modify administration site you have to clone this repo: !hod-administration-site After clone run this command at the project root:

npm start

It will open a live server in the url localhost:3000, navigate to localhost:3000/administration For more information about create-react-app go to the oficial repo !here

BUILDING CREATE REACT APP

You are almost ready to upload your page to production, but before that you have to create a production build of your react app (Administration page). To build your app firs stop the live server with keyboard keys:

Ctrl + c

And then run this command to create a stable build:

npm run build

This command will create a bundle of your aplication to the build folder then run this command to update the administration page served by your nodejs server:

cd build
cp -R * /PATH-TO/YOUR/NODE-SERVER/server/public
cd /PATH-TO/YOUR/NODE-SERVER/server/public
mv index.html administration

Your server it's ready to serve your administration page don't forget to remove your user "1" from database before upload your site to production.

Author

Óscar Medina

Acknowledgments

SkylabCoders JuanMa Garrido Manuel Barzi Joan Albert AlejandroDG