Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
magicMirror584677dboilerplate all things!
Step 1: Use knex.js for database queries, it's pretty good if you are not working with Mongo
Step 2: API first! Once you've established your API everything coming after is way easier
Step 3: Work with models (Interfaces). TypeScript is very powerful to type your requests and responses. Use TypeScript for your API as well to have the same syntax everywhere. If you prefer to work with ORM based libraries like Sequelize it is also an option, although I do not personally recommend it for most use cases.
Step 4: Once all the data can be retrieved, build your Angular frontend around the data. Your frontend should only perform API calls and have as little logic as possible.
Step 5: If your Database is very complex, integrate another layer for business logic. This will save you a lot of frustration if applied correctly.
- REST API Design Rulebook by Mark H. Massé
writeascript73677d@frickerg out of ignorance about other options I started with sequelize and my own way to build sql queries. knex will most probably clean things up a lot :) I'll have to look into models in typescript because I only followed the angular hero tour and a few guides before starting. I guess I'll also have to find out the business logic layer part, because there is a hell lot of complexity
@writeascript you are also not forced to use models (I call them models, they are basically TypeScript classes or interfaces) but it definitely helps a lot to keep your code clean and tidy. If for example your Express API returns something and you can already specify that it will be a promise with an array of Product it can save you a lot of time.
@writeascript and of course if you have question feel free to ask anytime. I've been clueless about all those topics a year ago, but I had to learn it in depth for my bachelor's thesis. I am very passionate about boilerplating all those things now and breaking it down for people who are new to it.
Don't hesitate to file an issue on the github repo I've provided! The boilerplate is unfinished and I would be very happy to finish it if there are some things you'd like to see demonstrated. Also collabs are awesome so feel free to modify it for a pull request
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job