loading...

Need a little help here.

github logo ・1 min read

I've been wondering how to setup my Rest API with node express , to retrieve data from MS SQL database.
From my research so far , i see that a popular approach is to use tedious and mssql packs for node , to establish a connection between the API and the database.
Can you suggest any less painful and easy to use approach ?
I don't really have much experience consuming data from ms sql via node ,
so i will appreciate any help :)

twitter logo DISCUSS (7)
markdown guide
 

I have no idea why one would use the proprietary Microsoft SQL server, but in case you really need to use it, consider using TypeOrm - a very simple and straight forward ORM.

TypeOrm Git Repo

As for the API server, I always recommend using GraphQL nowadays:

GraphQL Yoga Server Git Repo

If you however still wanna use Rest, check out LoopBack:

Loopback Website

Let me know if you have more questions, and if you are interested in a rapid MongoDB + GraphQL workflow, you could try out my little @libresat/service framework - see the Git Repo for more info, it's really easy to use!

 

Thanks for sharing this info with me Felix.
I will definitely look up into TypeOrm.
I am kinda stuck with MS SQL and Node , as its not up to
me to choose the technology stack but thanks
again for you suggestions.

 

Wait typeorm is Typescript (excellent suggestion if using Typescript) but perhaps the OP has not mentioned ts in which case bookshelf or sqlize are good ORM to try. Or if you want there are drivers to help you write raw queries. Coming from an MS stack I would highly recommend learning about Typescript for the future.

 

Most of the new REST APIs nowdays are generated with Open API (old swagger), it can generate even the JS handlers (for server and client) for you and the documentation from a simple YAML config file.

As for the node-ms sql connection I have no idea.

 

Great, tnx for the heads up.
But again my struggle here cannot be settled via
changing the stack , i really need an easy to use and configure
pack or tool to retrieve data with ms_sql via node(express).

 

Read more about Open API, it is a standard, it can be implemented with any stack, is just a theory, a common practice.

I am surely going to read the docs.
I have limited time to decide from which direction
to tackle this problem.
Appreciate your help.

Classic DEV Post from Feb 7

What are your favorite portfolio sites for devs?

I'm looking for some portfolio site inspiration! I'd love to see your favorite sites by other develop...

Squiff88 profile image

Sore eyes?

dev.to now has dark mode.

Go to the "misc" section of your settings and select night theme ❤️