Restopedia - consultantjay/LTIMEARN GitHub Wiki
What is Restopedia?
RESTOPEDIA is a restaurant search and discovery service website. It provides all required information like ratings, reviews, address along with the location on Google Map of the restaurants where the restaurants do not have their own website. Restopedia is a restaurant information and recommendation service that offers a restaurant search utility, with filtering by city, type of visitors and cuisines.
Product Description:
This is an application for restaurant search and discovery using MEAN Stack which allows user to search and list Restaurants according to the name, location and custom filters. The product also provides the facility to the user to view the Restaurant's location on the map.
Features to be delivered:
- Discovering restaurants according to end user's need
- Locating restaurants on Google map
- Sign in/sign up with validations and session management
- Search Restaurant on the basis of:
- Country
- City
- Cuisine
- Visitor's type
- Get detailed information about restaurants:
- Address
- Contact number
- Ratings
- Reviews
- Recommendation
- Currency used
- Provides interactive "contact us" mailing system
Future Scope:
- Featured restaurants
- Adding user reviews for each restaurants
- Online table booking option
- Data encryption and Google authentication
About
Restopedia 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.
Functionality:
MongoDB queries are used to access list of required details from the Database. * Documents: 18000 * Fields : 19
Node.js Query example. Documents are returned on the basis of city name provided. Business Name and description is returned by the following query.
var mongojs = require('mongojs');
var db = mongojs('LTI',['restopedia']);
db.restopedia.aggregate([{
$match:{
"City":"Glasgow"
}},
{$sort:{
"Rating": -1
}}],
function(err, docs){
res.json(docs);
}
});
The Service APIs are called whenever an event is hit on the User Interface. Express APIs are written in nodejs with callback functions to avoid any blocking, and allows other code to be run in the meantime. Express APIs are routing and middle ware web framework.
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.json());
var mongojs = require('mongojs');
var db = mongojs('LTI',['restopedia']);
app.use(express.static(__dirname));
//Search restaurants by name:
app.get('/:name', function(req, res){
var name = req.params.name;
db.restopedia.aggregate([
{ $match: {Name:name} },
{ $project: {Name:1, Address:1, Phone:1, City:1, State:1, Country:1, Rating:1} },
{ $sort: {Rating:-1} }],
function(err, docs){
res.json(docs);
}
);
});
app.listen(3000);
console.log("Server is running on port 3000...");