fac-17 / cgko-week-4 Goto Github PK
View Code? Open in Web Editor NEWSimple postcode autocomplete :checkered_flag:
Home Page: https://postcode-autocomplete.herokuapp.com/
Simple postcode autocomplete :checkered_flag:
Home Page: https://postcode-autocomplete.herokuapp.com/
Well done on using flexbox!
Maybe, adding a @media query for mobile / applicable for device under 320px to have something more centered?
Very helpful to have links to the research you've done!
Saw a couple of commented out code, it would be good to remove them once you no longer need them as well as some console logs you may not need anymore to keep your code from getting cluttered 👍
When the project is in production mode, it would be great to remove them.
I think, this can be a simple one :)
It would be interesting to see if it's possible to refactor the code of your handler.js file when you re-adjusting the variable 'extension'/'extensionType'. For e.g.: Taking it out of the handlePublic function, to put it in your global scope, so you can use it everywhere (have a look in our code, maybe it can help if what I say isn't super clear ^^)
handlers.js
requires querystring
but never uses it, which is confusing.
Maybe either use it or remove reference to it
Currently any incorrect url path is displaying your postcode.json file and not your 404 message. You may want to look at how you are determining any "wrong" paths in your router and possibly how you are handling errors in your handler.js file
No tests in the test.js folder, but i guess you know this already!
I'm learning with metaphors and this one is really helpul:
Backend is what you don't see unless you peek (but don't need to use the product), it's often more messy and complex. Frontend is what matters to the user and needs to be pretty!
I like that you put effort into making your const
and let
used approprietly. Not a single ugly var
in sight! 👍
const { handleHome, handlePublic, handleQuery } = require("../src/handler");
cool stuff 👍
in your index.js file(client side)
queryString is being defined as
let queryString = input.value;
and its directly sent to the server in a get request
xhr.open("GET", queryString, true);
the problem here is that urls only allow certain characters.
forbidden characters must be encoded into their hex equivalents.
(refer to week4 research, I have mentioned url encoding)
there is a convenient method encodeURIComponent() that will take your queryString and encode it in the correct format.
let queryString=encodeURIComponent(input.value)
Just a lil thing I saw in your html file is that you put your placeholder text within your datalist node I think you may have meant to put it in the input node so that it will show up in the input box. Alternatively I saw you had a label node for your input but it was empty, it's always good to include some text to help the user know what is to be expected of them to do for that input box.
Well done this week! You've gotten through it!
I know from my experience from this week is that it was definiately a learning curve. It has scarred me.
If you do find time to add more post codes that'll be cool (feeling a lil left out here in SE 🥺)
Good job using the datalist element!
But you may want to look into clearing it once the input is updated so that it does't keep adding results from previous inputs
server.listen(port);
console.log(`server up and running on port: ${port}`);
At the moment what it does it starts binding the port, then you outputs the message, then it starts the server, which can throw an error, so the message is premature.
Easy fix is to put the message inside the callback:
server.listen(port,()=>{
console.log(`server up and running on port: ${port}`);
});
It's a simple omission I presume: tape will look in the main dir of the project, but should look in test
dir. Even if test.js
is empty you might want to just add src/
in front of you tape path.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.