Existing Angular 2 project needs data from sql server? - node.js

I have a small Angular 2 application, but I can't find a way to connect and send queries to an existing sql server.
I found that I need to build a rest API and that I can use 'express.js'.
I also found that express.js can run my Angular 2 app at the same time as the backend server, but how do I set this up?
Can anyone point me in the right direction?
Thanks!!
Edit:
I'm still stuck, can anyone point me to a tutorial or something I can use to build an Angular 2 app that can send sql queries to a Microsoft SQL server and use this data in its templates?
Edit 2:
I used the Node package MSSQL to do this. Pretty easy when you get it set up.
MSSQL

You should look into setting up a SEAN stack application that would use Sequelize ORM to read from your SQL database.
https://github.com/MangoTools/sean
http://docs.sequelizejs.com/en/v3/

Related

Querying data from Microsoft SQL Server using GraphQL in a Node.js app

I have a node app (using express) that I built which can query my MS SQL server via the mssql npm package. I want to be able to use something like the express-graphql package to handle those queries. I have done this before with a Mongo DB and mongoose but I am having difficulty fitting these things together now. Does anyone know where I might find a tutorial ? I googled around and everything seemed to be for different SQL dbs. Alternatively, is there a better package I should be using?

I am trying to connect Angular to MongoDB

I have a simple Angular app and it is running in Local Host 4200. How do I save the form values and store them in a MongoDB database?
Angular is a web framework dedicated for the client-side, MongoDB is
a NoSQL database, to save your data put into your angular app to your
Database, you need a server-side implementation like nodejs or
python, java, etc ..
I recommend for you to use expressjs as an API framework it can helps you to get started
Angular is not supposed to connect directly to a DB in an real project, so there is not much of a point to practice doing so. You should have an server-side application or a mock to do so. If you are trying to build a front for studies you can use packages such as this one to begin: https://www.npmjs.com/package/auto-api
It is of simple use and you can save data without configuring or installing a DB.

Angular with Oracle

I am trying to figure out if there is a way to build applications using Angular/ORDS/Oracle, i am new to this web stack. What i understood so far is we need one front end / back end / database to build entire application.
in general we use Angular/Nodejs/Sql Server to develop application. in this Angular is front ent/ Node js is used to build backend or web services. Sql server is the database.
Is there a good example or resource to learn how to build apps using Angular/ORDS/Oracle with one CRUD example.
With Oracle and ORDS, you'll just define some REST Services to feed data to your Angular app.
You'll hopefully be making VERY similar, GET, PUT, POST, & DELETE calls as you were doing before.
You can 'shape' the Service templates to have the mapping that you want. They are then back-ended by Oracle SQL and/or PL/SQL that runs in the database.
ORDS handles paging the results and transforming everything in and out of the database to {json}
I have lots of resources for you getting started with REST Services in Oracle here.

Feathersjs frontend and backend in a single project

I'm looking to build a small customer management portal for myself. I've recently started working with node and vuejs a lot (coming from an html/css/javascript background). I've really enjoyed CLI development though and am looking to build a customer management portal (nothing fancy) that has a MySQL backend. After studying frameworks and ideas I found feathersjs which I REALLY like. After a few hours I was able to have a REST api that returns data from my MySQL database and uses authentication. I can get MySQL data in a JSON datasource and even do inserts, updates, deletes. I generated the services and models using the feathersjs CLI generator.
My question is, do I really need to make two separate projects (one for backend and one for a public frontend) and run them each on a node server? Or could I do this in as single project? I'm still learning and reading up on feathersjs but I'm not seeing a way to make this possible. I do see a public folder in my feathersjs project that was generated but I don't know how to utilize it for node (I wanted my frontend written in Vue). I can see how static HTMLfiles would work in this public folder.

Connect to MongoDB remote server with Ionic

I'm trying to develop an application in phonegap/ionic and I want to use a remote database to store my data. I want to use MongoDB.
I already tried lots of ways such as this quick start guide.
By using this I can connect to DB but this is pure node.js and the require() function cannot be recognized when I try to add this code to an ionic starter app. Maybe require is not supported in ionic
Is there a way that can achieve it in Ionic?
Please let me know if you want some more information.
The thing is; you can't connect Ionic to MongoDB directly. No, there's not workaround, no magic involved, it's just not the way this is supposed to work. Ionic works on top of Angular and Angular is a frontend framework.
However, the way you should do it is that you basically create a (RESTful) API on your server side.
Most likely this will be made with Node.js which will talk directly to MongoDB and query it. A framework very well suited for this (you actually may be using it already) is Express.
After you write your (RESTful) API then you can consume it through your services in Angular by using Angular's $resource object.
Sure, this is not a step by step answer, and it seems you're just starting in this area, so you have some learning do to on your part (REST, RESTful, $resource, services...), but I wish you good luck and if you'll have any more specific questions, don't hesitate to ask them.

Resources