Hunt Your Stay - consultantjay/LTIMEARN GitHub Wiki
Hunt Your Stay
Hunt Your Stay is a web application that provides customers and travellers with hotels and alternate stay accommodations in India. Customers can easily view and choose their stays in various places according to their budgets and based on the facilities they wish to avail.
Product Description
Hunt Your Stay is a full fledged hotel listing and searching web application developed using MEAN stack. It allows users to view various hotels and stay accommodations across the country and choose between them. Users can easily search for hotels based on their requirements and budgets. It also includes map feature to help users locate their stays in a better way.
Features to be delivered
- Listing hotels and stay accommodations for users to view.
- Searching filters based on hotel name and city.
- Sorting list of hotels based on price.
- Detail view of each product available.
- Map view of hotels to help users locate them in a better way.
- Review form is included to take feedback from customers for further improvements.
Future Scope
- Hotel booking and payment interface.
- Include mail and SMS API to send booking confirmation messages.
- Expansion of data set to further include more services and across several countries.
About
Hunt Your Stay is built on all the latest technologies which include:
- MongoDB
- Node.js
- Express.js
- Angular
- React
MongoDB
MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need. MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc., and is published under a combination of the GNU Affero General Public License and the Apache License.
Why No SQL?
When compared to relational databases, NoSQL databases are more scalable and provide superior performance, and their data model addresses several issues that the relational model is not designed to address:
- Large volumes of rapidly changing structured, semi-structured, and unstructured data.
- Agile sprints, quick schema iteration, and frequent code pushes.
- Object-oriented programming that is easy to use and flexible.
- Geographically distributed scale-out architecture instead of expensive, monolithic architecture.
Coding standards used for MongoDB:
- Consistency in naming conventions and existing styles in file.
- Unit testing for each module.
- Proper comments included wherever necessary.
- ReStructured Text and Typesetting: Placing spaces between nested parentheticals and elements in JavaScript examples. For example, prefering { [ a, a, a ] } over {[a,a,a]}.
- Maintaining backwards compatibility.
Node.js
Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code server-side. Historically, JavaScript was used primarily for client-side scripting, in which scripts written in JavaScript are embedded in a webpage's HTML and run client-side by a JavaScript engine in the user's web browser.
Coding standards used for Node.js:
-
Keep lines shorter than 80 characters.
-
Tab spaces must be 2 spaces.
-
Curly braces: Use:
function(){
..}
instead of:
function()
{..}
-
Comma first:
Use:
`var alpha = [ 'A'``
`, 'B'`` `, 'C'`` `]`
-
Using single quotes for strings.
-
Callback should be the last argument in list.
-
Always create a new Error object with your message. Don't just return a string message to the callback. Stack traces are handy.
-
Naming conventions:
- Use UpperCamelCase for class names.
- Use lowerCamelCase for identifiers.
-
Create logger using npmlog utility.
-
null, undefined: Don't set things to undefined. Reserve that value to mean "not yet set to anything. Boolean objects are forbidden.
Express.js
Express.js, or simply Express, is a web application framework for Node.js, released as free and open-source software under the MIT License. It is designed for building web applications and APIs.It has been called the de facto standard server framework for Node.js.
Coding standards used for Express.js:
- 2 spaces – for indentation
- Single quotes for strings
- No semicolons
- No unused variables
- Always use === instead of == – but obj == null is allowed to check null || undefined.
Angular
Angular (commonly referred to as "Angular 2+" or "Angular v2 and above") is a TypeScript-based open-source front-end web application platform led by the Angular Team at Google and by a community of individuals and corporations. Angular is a complete rewrite from the same team that built AngularJS.
Coding standards used for Angular:
- Proper naming conventions should be used for file structure.
- Single responsibility feature should be used, which makes the application cleaner, easy to read and maintain.
- Proper naming naming conventions across the project is vital for maintaining consistency.
- Bootstrapping: Avoid putting app logic in main.ts. Instead, consider placing it in a component or service.
- Directive selectors: lower camel case for naming the selectors of directives.
- Unit test file names: Naming test specification files the same as the component they test.
- Coding conventions Classes: Upper camel case when naming classes. Constants: Declaring variables with const if their values should not change during the application lifetime. Properties and methods: Lower camel case to name properties and methods.
React
In computing, React (also known as React.js or ReactJS) is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies.React can be used as a base in the development of single-page or mobile applications. Complex React applications usually require the use of additional libraries for state management, routing, and interaction with an API.
Coding standards used for React:
- Destructuring props: It makes assigning object properties to variables feel like much less of a chore.
- One tag, one line
- Wrap up: Only write JSX on the right side of an = or a return.
Functionality
MongoDB queries are used to access list of required details from the Database.
Documents: 1200
Fields : 19
Node.js Query example. Documents are returned on the basis of city and/or hotel name provided. Hotel Name and description is returned by the following query.
//*1.Search by city and hotel star rating
var mongojs=require('mongojs');
var db=mongojs('Project',['hotel']);
`db.hotel.find({city:"kakinada"},`
`{_id:0,property_name:1,hotel_description:1},`
`function(err,res){`
`console.log(res);`
});
The Service APIs are called whenever an event is hit on the User Interface. Express APIs are written in node.js with callback functions to avoid any blocking, and allows other code to be run in the meantime.
var express = require('express');
var app=express();
var bodyParser = require('body-parser');
app.use(bodyParser.json());
var mongojs=require('mongojs');
var db = mongojs('project',['hotel']);
app.use(express.static(__dirname)); //to tell server that this is root folder
//Service call for list users
app.get('/list',function(req,res){
`db.hotel.find(function(err,docs){res.json(docs);`
})
});
app.listen(3000);
console.log("Running on port 3000");