https://github.com/programando-ideas/webapi.mongodb
ASP.NET Core WebApi + MongoDb
https://github.com/programando-ideas/webapi.mongodb
aspnetcore csharp mongodb video webapi-core webapi-mongodb
Last synced: 10 days ago
JSON representation
ASP.NET Core WebApi + MongoDb
- Host: GitHub
- URL: https://github.com/programando-ideas/webapi.mongodb
- Owner: programando-ideas
- Created: 2020-05-01T20:34:45.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T23:28:38.000Z (about 3 years ago)
- Last Synced: 2025-07-12T07:31:57.346Z (8 months ago)
- Topics: aspnetcore, csharp, mongodb, video, webapi-core, webapi-mongodb
- Language: C#
- Size: 76.2 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ASP.NET Core WebApi + MongoDb
Proyecto con operaciones CRUD sobre **MongoDb** expuestas en una WebApi hecha con **ASP.NET Core 3.1***
## Videos Youtube (π π²π―.ππ€π³ π’πππΎ πΆπΎπ»π ππ + π¬πππππ£π‘ πππ)
- [π₯ Parte I](https://youtu.be/mI64TjWxVgI)
- [π₯ Parte II](https://youtu.be/j2f07ZGKqpo)
### Herramientas necesarias para este video
- [x] [MongoDb Server Community](https://www.mongodb.com/download-center/community)
- [x] [MongoDb Compass](https://www.mongodb.com/download-center/compass)
- [x] [Visual Studio 2019 Community](https://visualstudio.microsoft.com/es/vs/community/)
- [x] [.net Core](https://dotnet.microsoft.com/download)
- [x] [Postman free](https://www.postman.com/downloads/)
- [x] [SoapUI Open source](https://www.soapui.org/downloads/soapui/)
### Links con DocumentaciΓ³n utilizada en los Videos
- [x] [MongoDB db.createUser](https://docs.mongodb.com/manual/reference/method/db.createUser/)
- [x] [MongoClient instance global](http://mongodb.github.io/mongo-csharp-driver/2.0/reference/driver/connecting/#re-use)
- [x] [IQueryable Interface](https://docs.microsoft.com/en-us/dotnet/api/system.linq.iqueryable?view=netcore-3.1)
- [x] [IMongoQueryable](https://mongodb.github.io/mongo-csharp-driver/2.4/apidocs/html/Methods_T_MongoDB_Driver_Linq_IMongoQueryable_1.htm)
- [x] [Async dotnet](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/)
## Startup.cs
```csharp
services.Configure(
Configuration.GetSection(nameof(ClientesStoreDatabaseSettings)));
services.AddSingleton(sp =>
sp.GetRequiredService>().Value);
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
// http://mongodb.github.io/mongo-csharp-driver/2.0/reference/driver/connecting/#re-use
services.AddSingleton();
```
#### Logger en acciΓ³n

## Elemplo de URLs para utilizar con Postman
#### GET
- http://localhost:5000/api/clientes/5eac64158a01245a2c89fb0c
- http://localhost:5000/api/clientesiq/getbydir/123
- http://localhost:5000/api/clientesasync
#### POST
- http://localhost:5000/api/clientes
```json
{
"nombre": "Cliente 1",
"apellido": "Apellido 1",
"edad": 37,
"telefonos": [
{
"id": 1,
"tel": "+555555555555"
},
{
"id": 2,
"tel": "+111111111111"
},
{
"id": 3,
"tel": "+222222222222"
},
{
"id": 4,
"tel": "+999999999999"
}
],
"direccionCliente": {
"id": 0,
"calle": "Calle 123",
"numero": "133",
"depto": "3a"
}
}
```
#### PUT
```json
{
"id": "{Id Creado}",
"nombre": "Cliente 1 12345",
"apellido": "Apellido 1",
"edad": 37,
"telefonos": [
{
"id": 1,
"tel": "+555555555555"
},
{
"id": 2,
"tel": "+111111111111"
},
{
"id": 3,
"tel": "+222222222222"
},
{
"id": 4,
"tel": "+999999999999"
}
],
"direccionCliente": {
"calle": "Calle 123",
"numero": "133",
"depto": "3a"
}
}
```
#### DEL
- http://localhost:5000/api/clientes/5eac64158a01245a2c89fb0c
## Directorio JsonTest
#### Json con ejemplos para crear y actualizar un cliente
- CREATE_POST.json
- UPDATE_PUT.json
#### Proyecto de SoapUI para ejecutar el "Load Test"
- [LoadTest_MongoDB_API.xml](https://raw.githubusercontent.com/programando-ideas/webapi.mongodb/master/JsonTest/LoadTest_MongoDB_API.xml)

------------
#### Programando Ideas 2020