Git Product home page Git Product logo

discover-countries's People

Contributors

asem1789 avatar asmaathabet avatar maiubeid avatar yosefanajjar avatar

Watchers

 avatar  avatar  avatar

discover-countries's Issues

make data.JSON handler

  • make handler for json file which contain data about countries and its cities and add it to index.js file in handler folder .

the error when reading file

if (error) {
res.writeHead(404, { 'Content-Type': 'text/html' });
res.end('<h1>Page Not Found</h1>');
} else {
.
The files not found is one case from several cases if you need to handle the not found files you must check the code in error object then send not found, the error may be from the server when reading the file or the path for directory not for the file there is a lot of situations.

{ Error: ENOENT: no such file or directory, open '****the file path***'
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '****the file path***' }

make file structure

  • Add project file structure .
  • add public folder that contains index.html ,css[style.css], js[scripts.js ,dom.js ],assets folders .
  • add src folder that contains server.js , router.js, handler folder and API folder .
  • add handler folder that contain handler files inside src route .
  • add API folder that conatin json file
  • add test folder for testing files
  • add eslint dev-dependency .
  • add tape dev-dependancy and tap-spec dev-dependancy .
  • add .gitignore file to ignore node-modules .

setTimeout !!!!!!

t = setTimeout(() => {

I do not understand why to use setTimeout.
If you put it to make some delay when to fetch data you feel fast because of the data and the server in your own computer.
But when deploying the app there is enough delay without using setTimeout because of the speed of the internet and another issues.

your issues

why some of your issues are empty.
you must put a description to your issues to understand what these issues do

make simple Page structure

  • add html content , script links , css links for index.html .
  • add css initial style :
    • add backgirund for the main page .
    • add search input for search .
    • add div for search results .

why additional file

const handleHome = require('./handleHome');
const handleStatics = require('./handleStatics');
const handleD = require('./handleAPI');
module.exports = { handleHome, handleStatics, handleD };

What the benefits of making require for all handler files?
In my opinion, you can require the handlers files directly in router.js instead of export it then require then export then require.

too many, big requests

your file is 1.5mb
and u send it every key down every .8s, yes good job on this one, it greatly helped the server
but it gets pretty messy
image
imagine someone with 200kb/s using the website
it would take 7s to receive the file at that point, is that even autocomplete at this point?
BUT nevermind this, u dont have to change anything, but i had to point this out, so u imagine what unwanted effects this approach has

my suggestions, would be that u either send the file once, or handle the request in the server and send the user the name of the countries only, and when he clicks on a country, u make another request for that country cities

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.