Skip to content

qasim2020/playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Before you go further. I wrote a whole 2 hour long "Proud Readme" that Nate my mob mate deleted (by mistake). Ingen fara ;)


Ok coming back to the topic. This repo is good (I mean it - not because I came up with this idea sitting in the toilet!). I built it in over 2 years. So you will find important stuff here (if you dig).

Introduction

Playground is my self-built mini-CMS (e.g. Wordpress is a CMS), where I host my websites (I built for family + friends). Techstack includes Nodejs, MongoDB, Handlebars and Pjax.

Benefits

  • CMS - Content Management System - Content is "data" and "modules". For example, "SendMail" module is written & maintained once, and it works for all the websites hosted on CMS. Now next time I am building a website, I do not need to copy paste the code. You just need to call this module, and it is available to you. Nice ;).
  • It is easier to work on a single project (this CMS is one project). Code doesn't go lost in the void. Before building it, everytime I wrote my million dollar idea, some days later it just goes lost in the void. So, some actual workable ideas goes flat with that.
  • Do all of that in 6 USD Digital Ocean droplet (I started with this benefit in mind, but now realise there are other ways too to save money - humbled).

Connected Websites

Kinds of request you can make to playground

How it works

All requests reaching the server are formatted in following syntax;

app.get(
'/:brand/:permit/:requiredType/:module/:input', 
replyFunction 
);
  1. :brand is a brand's unique key. The website unique key (for example 7am) in this url :- https://7amuniforms.com/7am/data/page/landingPage/n.
  2. :permit is the request authentication type. It has three types; gen, auth, admin. Gen is general level request. Auth is for owners of the website. And Admin is for the super admins.
  3. :requiredType is the type of request you are making to the website. It has three types also; page, data, and pjax. Page is when user wants the rendered website. Data is when user is looking only for the data (the JSON). and Pjax is when he is looking for a portion of the website.
  4. :module is the name of the module. For example, when sending mail, the sendMail module in the server is accessible. Just send the email, mail text, email template and it sends the email to website owner's email address (or ship a newsletters to many subscribers).
  5. :input is the kind of input that you send to the module. For example showBlog module takes the blog-slug as its input. Slug is a unique identifier for each blog post in the database.
  • replyFunction then constructs a webPage || a data object || a pjax page and returns the website to the client.

ahh, if you have made this far

Leave a comment, some feedback, that you think can help me improve my code.