pixeltopic / wayfarer-2-server Goto Github PK
View Code? Open in Web Editor NEWNode backend for wayfarer-2
Node backend for wayfarer-2
I currently have everything as just a number by itself (eg 400, 403, 401...)
This is bad. See https://en.wikipedia.org/wiki/Magic_number_(programming)
I have already begun refactoring it by using the HttpStatus package.
Add it as a key in dev.js
and prod.js
, but on prod make sure it says false.
Remove all console.logs and replace them with winston.logger.
Bad coding practices return to haunt me
Using a deprecated package. Migrate to this instead https://www.npmjs.com/package/bcrypt
Use joi to validate schemas of incoming post requests to simply validation logic.
Proposal: Make page token search its own endpoint to prevent schema complications.
As stated in Node Best Practices, centralized error handling should be used. While I think the complexity of the app does not yet warrant a dedicated object, it would be good practice to implement a middleware that catches all errors.
Use something like mocha and chai to write tests to ensure endpoint behavior is working properly
Some project structure choices are unsatisfactory. Before beginning the next round of endpoints for registered users, refactor these (This link provides a good guideline and frame of reference):
repositories
convention in golang project structure)refreshedToken
should be renamed to token
, and should always return either the currently valid token or a refreshed token. The frontend will update the token on each call. The refreshed or current auth token should be sent in res.locals instead of req.auth
.
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.