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 :)
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (8)
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.
This is old but just putting this out there:
If you don't want to deal with ORM or GraphQL, and just need a quick start, then just do
tedious
is the low-level library for connecting to MSSQL, whilesequelize
offers a nice interface and supportssql-template-string
.You can then just do this:
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.