You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,9 @@ To work in GitHub, go to https://github.com/microsoft/sql-server-samples and for
8
8
9
9
Each sample should be in its own folder with a README.md file that follows the [template](README_samples_template.md). Generated files (e.g., .exe or .bacpac) and user configuration settings (e.g., .user) should not be committed to GitHub.
10
10
11
+
## Code of Conduct
12
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
13
+
11
14
## License
12
15
These samples and templates are all licensed under the MIT license. See the license.txt file in the root.
# NodeJS Express4 REST API that uses SQL/JSON functionalites
2
+
3
+
This project contains an example implementation of NodeJS REST API with CRUD operations on a simple Todo table. You can learn how to build REST API on the existing database schema using new JSON functionalities that are available in SQL Server 2016 (or higher) and Azure SQL Database.
4
+
5
+
### Contents
6
+
7
+
[About this sample](#about-this-sample)<br/>
8
+
[Before you begin](#before-you-begin)<br/>
9
+
[Run this sample](#run-this-sample)<br/>
10
+
[Sample details](#sample-details)<br/>
11
+
[Disclaimers](#disclaimers)<br/>
12
+
[Related links](#related-links)<br/>
13
+
14
+
<aname=about-this-sample></a>
15
+
16
+
## About this sample
17
+
18
+
-**Applies to:** SQL Server 2016 (or higher), Azure SQL Database
19
+
-**Key features:** JSON Functions in SQL Server 2016/Azure SQL Database - FOR JSON and OPENJSON
20
+
-**Programming Language:** JavaScript (NodeJS)
21
+
-**Authors:** Jovan Popovic
22
+
23
+
<aname=before-you-begin></a>
24
+
25
+
## Before you begin
26
+
27
+
To run this sample, you need the following prerequisites.
28
+
29
+
**Software prerequisites:**
30
+
31
+
1. SQL Server 2016 (or higher) or an Azure SQL Database
32
+
2. Visual Studio 2015 (or higher) with the NodeJS
33
+
34
+
**Azure prerequisites:**
35
+
36
+
1. Permission to create an Azure SQL Database
37
+
38
+
<aname=run-this-sample></a>
39
+
40
+
## Run this sample
41
+
42
+
1. Navigate to the folder where you have downloaded sample and run **npm install** in command window. This command will install necessary npm packages defined in project.json.
43
+
44
+
2. From SQL Server Management Studio or Sql Server Data Tools connect to your SQL Server 2016 or Azure SQL database and execute setup.sql script that will create and populate Todo table in the database.
45
+
46
+
3. From Visual Studio, open the **TodoApp.xproj** file from the root directory,
47
+
48
+
4. Locate db.js file in the project, change database connection info in createConnection() method to reference your database, and build solution using Ctrl+Shift+B, right-click on project + Build, or Build/Build Solution from menu.
49
+
50
+
5. Run sample app using F5 or Ctrl+F5,
51
+
4.1. Open /api/Todo Url to get all Todo items as a JSON array,
52
+
4.2. Open /api/Todo/1 Url to get details about a single Todo item with id 1,
53
+
4.3. Send POST, PUT, PATCH, or DELETE Http requests to update content of Todo table.
54
+
55
+
<aname=sample-details></a>
56
+
57
+
## Sample details
58
+
59
+
This sample application shows how to create simple REST API service that performs CRUD operations on a simple Todo table.
60
+
NodeJS REST API is used to implement REST Service in the example.
61
+
Service uses built-in JSON functionalities that are available in SQL Server 2016 and Azure SQL Database.
62
+
63
+
<aname=disclaimers></a>
64
+
65
+
## Disclaimers
66
+
The code included in this sample is not intended demonstrate some general guidances and arhitectural patterns for web development.
67
+
It contains minimal code required to create REST API.
68
+
You can easily modify this code to fit the architecture of your application.
69
+
70
+
<aname=related-links></a>
71
+
72
+
## Related Links
73
+
74
+
For more information, see this [MSDN documentation](https://msdn.microsoft.com/en-us/library/dn921897.aspx).
75
+
76
+
## Code of Conduct
77
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
78
+
79
+
## License
80
+
These samples and templates are all licensed under the MIT license. See the license.txt file in the root.
81
+
82
+
## Questions
83
+
Email questions to: sqlserversamples@microsoft.com.
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
0 commit comments