Reputation: 107
I'm trying to make a rework on one of our systems at work, the system runs in Laravel framework with blade templates.
I want to run it on Angular, NodeJS and mySQL (Database can't be changed).
I found A LOT of tutorials about how to make this work with mongoDB and/or other template engines, but I want to specifically run it on Angular 2+.
I'm having trouble understanding how can I use my normal routes on Angular and get information out of SQL to show on the frontend, because on those tutorials, express uses it's own routes.
Can anyone shine some light on that matter? Possibly chat with me through discord or something.
My Discord ID: Platiplus#1182
Upvotes: 2
Views: 4089
Reputation: 2454
There is no short answer to setup a project build(s). I think the way to go for you is to setup a build script with webpack for the frontend. See the docs.
The backend can easily be setup with express. Init a project with express, and you should be able to run your Node.js backend with a command like 'npm start'. See this guide.
For the database, you need to hookup your backend with your Node.js backend. This can probably (I haven't tried this myself) easily be done with a MySQL npm driver, like this one.
This covers how to get started - Isolate the 3 layers and get the builds up and running. Be aware that Angular's production build differs from the development build, and is more of a hassle to setup. But my advice on this is to start with getting the development build up and running, and afterwards focus on creating a production build with the AOT compiler
Upvotes: 1
Reputation: 1461
If you're going to use Node.js with MySQL, I highly recommend using a query builder instead of the MySQL npm package. Take a look at knex. http://knexjs.org
Upvotes: 1