Sambhalo is an entry-management software catering to the requirements by Innovaccer's summergeeks program.
Read the problem statement here: Link
- Setup and Installation
- Tech Stack Used
- Explanation
- Working with the app
- Exception handling done
- Contact Me
NOTE: These installation instructions assume that you have nodejs, npm and mongodb installed on your system.
If not head over to the links below:
Please do make sure that these softwares are installed on your system otherwise the app wont work. Be sure to check out stack overflow if facing any errors.
Installation Steps:
-
clone or download this repository.
-
using your favourite file editor open the file called sendEmail.js inside the helper folder and wherever you see 'Enter email here' and 'Enter password here' just put your email id and password (dont worry it's safe :)) with which emails are to be sent. If using any other service than gmail make sure to change the 'service' from 'gmail' to whatever service you are using. List of supported services. Make sure that the account you use provides access to less secure sites.
-
now open sendFbEmail.js and repeat step 3.
-
open sendText.js and enter your twilio account-SID,authentication token and phone number wherever required.Here's how to work with twilio. Also this has to be noted that twilio works well with only registered phone numbers and there are some government restrictions regarding sending text in India..
-
open app.js and uncomment 'sendEmail' and 'sendText' and 'sendFbEmail' functions if you wish to send emails or text. These can be found :
- in
app.post("\")
route - in
app.post("\newHost")
route - in
app.post("\meeting")
route - in
app.post("\verify")
route - in
app.post("\feedBack")
route
- in
-
Optional: uncomment
seedDB()
function in "app.js" which removes all existing data from the database and fills in some dummy hosts. -
run
sudo service mongod start
or any other command you use to start the mongo server.- you can check if the server is running using
sudo service mongod status
.
- you can check if the server is running using
-
get into this directory (via terminal or your own native OS method).
-
run
npm install
(in another terminal not the mongo one) to install all the required dependencies.- after this step you should see a node_modules folder if not something went wrong, check your steps.
-
run
node app.js
(while being in the same folder directory) and you should be good to go.- if you see error like
Error: Cannot find module 'express'
just donpm install express
in the same directory(in some cases express needs to be installed locally).
- if you see error like
-
if everything went fine you should be able to see the website hosted at localhost:3000 :)
1.Mongo is flexible and if there are slight change in requirements, relational DBs may waste a lot of space. 1. Example: if only one of phone and email are required instead of both, there may be lot of null values in a relational database. 2. Example 2: like instead of a single address there are multiple addresses associated with a office (usually the case with many offices) and hence
2.Mongo leverages a JSON-style storage format known as binary JSON, or BSON, to achieve high throughput. It integrates well with node and express.
- Mongoose provides with the advantage of abstraction over pure mongo, using Schemas, it also implements validations to Schemas making them easier to work with also there are many plugins available.
-
Because application was small and required less dynamic rendering and using frameworks like React or Angular for such a small application seemed redundant.
-
Vanilla JS can be easily understood by most of the web developers.
-
Use of ejs (EJS is a simple templating language that generates HTML markup with plain JavaScript. ... It's just plain JavaScript) and made handling data in and out of html pages much easy.
-
Made use of bootstrap for easy styling and make website mobile responsive.
-
Node package manager(npm) has lot of available functionalities making it easy to implement facilities like email and phone messaging.
-
Language is similar to javascript and it is again easy to understand for most web developers
-
Allows handling simultaneous requests with ease.
-
Express is a framework built on nodeJs and makes dealing with routes easier and also synchronizes well with ejs.
- helper - contains helper functions like sendEmail, sendFbEmail, sendText, tConvert (to convert time), genOTP (to generate a OTP).
- models - contains basic schemas of models used i.e. visitor, host, feedaback.
- node_modules - contains all the basic dependencies required to run app.
- public - contains all the stylesheets used
- views - contains all the ejs files that need to be rendered
- partials- contains the header and footer ejs files that need to be included in every document.
-
Text messages : first one is when visitor checks in and second one when visitor checks out.
-
Emails messages : first one is when visitor checks in and second one when visitor checks out and third one is the OTP email.
-
Feedback Email : email recieved when visitor fills feedback form.
Here's a list of exception handling done in the app:
- if a visitor is currently checked in another user with same email or password cannot check in.
- email and contact of hosts should be unique else they will not be added and also need to be verified by a OTP.
- visitor cannot proceed to check-in without filling all the fields of the form.
- one visitor cannot check-out any other visitor due to OTP recieved which also ensures that visitor provided the correct email id while checking in else he will not be able to check out.
- one can only access feedback page while checking out.
- in feedback form atleast the table should be filled otherwise it will again redirect back to the feedback page.
You can contact me at 17uec112@lnmiit.ac.in or shivamd011@gmail.com