mohamad-monir / class18-project-mohamad Goto Github PK
View Code? Open in Web Editor NEWclass18 graduate project
class18 graduate project
I have been asked to review your project.
Here is my review for the server
Questions
index.htm
and style.css
? React should handle thatImprovements
package.json
Make sure to have scripts for bother server and client and install proper dependencies for the server
{
"server": "server script",
"client": "client script",
"dev": "run both server and client scripts"
}
server/app.js
You don't need this, at least for development mode
app.use(express.static(path.join(__dirname, "public")));
You are not taking advantages of these so you don't need them
app.get("*", (req, res, next) => { //no need to name the function, you can simply use arrow function
console.log("someone made a request with GET method");
next();
});
app.get("/", function(req, res) {
res.send("index page, triggered by GET /");
});
handle 404 error after using api routes
app.use("/api", apiRouter);
//handle 404 errors here with your custom message
server/Index.js
don't use port like this, while hosting the website the host will provide dynamic ports
so change it to
const PORT = process.env.PORT || 5000;
server/validation.js
Null is an object too so check if it's not Null too
if (typeof houseObj !== 'object') {
api/index.js
fakeDb is not defined or imported, how do you use it?
There should be some consistency between all your responses so try to always use a pattern so the client understands you better
I always try to do it like this
res.status(status code here).json({ error: false or true, message: success or error message, data: data to send})
Parse the id
s before use it in the find loops
Here my review for the client
-Firstly you need to work on the application folder structure
That's what i do for mine(it's not the best but works for small projects)
src
-components
--headerNav.js
-containers
--Home.js
--Login.js
-assets
-styels
-utils
index.js
-Make sure all component files start with a capital letter so we know it's a component before even open the file
App.js
-Separate the Routes and NavBar
Routers
Change the folder name may be
Routers/Contributers.js
isPostingToServer
...etcRouters/Form.js
same as Routers/Contributers.js
Routers/Home.js
Routers/HouseList.js
try..catch
blockcatch
for the fetch
or try...catch
when using async..await
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.