Foodies - consultantjay/LTIMEARN GitHub Wiki
What is Foodies?
Foodies, is web application to get details of restaurant of US. Foodies, aims to provide restaurant Details of each cities of US country. Foodies provide best search and discovery of restaurants with Sufficient Details of particular Restaurant .
Product Description:
Foodies is web application developed developed by MEAN stack to provide details of restaurants On various criteria. This application give location of each restaurant on map with each details of User desire.
Features that will be delivered:
- Having different search Criteria’s like (Country Zone, City Name, Restaurant Name)
- Sorting of restaurant information based on rating of restaurants
- Provide location of each restaurant using Google Map
- user can also give feedback
Future Scope(features that will be included later)
- Booking of Restaurant table
- get comparison between restaurants on various criteria
- Expanding dataset information to cover more countries restaurants
About
Foodies is built on all the latest technologies that include:
1. MongoDB
2. Node.js
3. Express.js
4. Angular
5. React
Mongo:
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 NoSQL?
NoSQL systems are distributed, non-relational databases designed for large-scale data storage and for massively-parallel, high-performance data processing across a large number of commodity servers. They arose out of a need for agility, performance, and scale, and can support a wide set of use cases, including exploratory and predictive analytics in real-time. They arose out of a need for agility, performance, and scale, and can support a wide set of use cases, including exploratory and predictive analytics in real-time. Built by top internet companies to keep pace with the data deluge, NoSQL data base scales horizontally, and is designed to scale to hundreds of millions and even billions of users doing updates as well as reads.
Following MongoDB Coding-style is used:
1. Consistency: The most important guideline is to be consistent with the existing style in the files.
Ex: Followed the spacing or naming conventions in the file that is to be edited.
2. Adding tests for new functionalities.
3. Ensuring code is readable with proper comments wherever necessary.
4. Maintaining backwards compatibility by:
o Avoid changes that break the project's functionality and cause existing tests to fail
unexpectedly.
o Avoid changes that affect the project's compatibility with other projects.
5. ReStructured Text and Typesetting: Placing spaces between nested parentheticals and elements in JavaScript
examples. For example, prefering { [ a, a, a ] } over {[a,a,a]}.
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. Following Nodejs and npm Coding-style is used:
npm's coding style is a bit unconventional. It is not different for difference's sake, but rather a carefully crafted style that is designed to reduce visual clutter and make bugs more apparent.
1. Line Length: Keep lines shorter than 80 characters.
2. Indentation: Two-spaces. Tab can be used but Node uses 2 spaces and so followed this.
3. Curly braces:
o Using this:
4. function(){
..}
o Avoiding this:
function()
{..}
5. Comma First:
o Using this:
6. var magicWords = [ 'abracadabra'`
7. , 'gesundheit'`
8. , 'ventrilo'`
]
9. Quotes: Use single quotes for strings except to avoid escaping.
o Preferring this: var ok = 'String contains "double" quotes'
10. Callbacks, Sync/async Style:
o Use the asynchronous/non-blocking versions of things as much as possible. It might make more sense for
npm to use the synchronous fs APIs, but this way, the fs and http and child process stuff all uses the
same callback-passing methodology.
o The callback should always be the last argument in the list. Its first argument is the Error or null.
11. Errors:
o Always create a new Error object with your message. Don't just return a string message to the callback.
Stack traces are handy.
12. Logging: Logging is done using the npmlog utility.
13. Case, naming:
o Use lowerCamelCase for multiword identifiers when they refer to objects, functions, methods, properties,
or anything not specified in this section.
o Use UpperCamelCase for class names.
14. 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.
Following Express.js Coding-style is used:
1. 2 spaces – for indentation
2. Single quotes for strings
3. No semicolons
4. No unused variables
5. 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.
Following Coding-style is used:
1. File structure conventions:
o The name of the components should make resemblance with the functionality for which it has been
built.
2. Single responsibility:
o This helps make the app cleaner, easier to read and maintain, and more testable.
3. Naming:
o Naming conventions help provide a consistent way to find content at a glance. Consistency within
the project is vital. Consistency with a team is important. Consistency across a company provides
tremendous efficiency.
o Names of folders and files should clearly convey their intent.
4. Bootstrapping: Avoid putting app logic in main.ts. Instead, consider placing it in a component or service.
5. Directive selectors: lower camel case for naming the selectors of directives.
6. Unit test file names: Naming test specification files the same as the component they test.
7. Coding conventions
o Classes: Upper camel case when naming classes.
o Constants: Declaring variables with const if their values should not change during the application
lifetime.
o 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.
Following Coding-style is used:
1. Destructuring props: It makes assigning object properties to variables feel like much less of a chore.
2. One tag, one line
3. 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 database as according to search criateria.
- Documents: 18155
- Fields : 20
Node.js Query example. Documents are returned on the basis of country name provided. restaurant name an all essential dertails is returned by the following query.
1.Search by country name
var mongojs=require('mongojs');
var db=mongojs('pro',['rest']);
db.rest.aggregate([{$match:{
country:"US-zone-3"
}
}],function(err,res){
console.log(JSON.stringify(res));
}
);
The Service APIs are called whenever an service is hit on the User Interface by the type script function function as according to condition.
Express APIs are written in node.js with callback functions to avoid any blocking and provide asynchronous execution , 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('pro',['rest']);
app.use(express.static(__dirname));
app.get('/country/:country',function(req,res){
db.rest.aggregate([{$match:{
country:req.params.country
}
}],function(err,docs){
res.json(docs);
}
);
}
);
Help
• MongoDB
• Node.js
• Express.js
• Angular