-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial NANCY.NET 2017 #9
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All 6 endpoints are implemented.
The tutorial can be finished in less than 3 hours.
There were some formatting issues making it hard to read the code snippets in the README. (only on the text editor I was using to read the file, on the github site the file displays correctly)
Some lines of code were missing from the README but they could be found on the files the tutorial was referencing.
An important command for the configuration of the project is missing
-> PM > Install-Package Nancy.Hosting.Aspnet
Fiddler is not at all required to test the API, it was easier for me to use a browser extension.
The steps to test the API could have been a little more clear.
3. HealthP.cs data structure of healthprofile | ||
``` | ||
1. MainModule.cs | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a blank line before the '''
Also you can specify the language for code highlights with '''csharp
|
||
## Getting Started: Install packages | ||
Let's start exploring this framework. Open Visual Studio and then: | ||
``` create an "ASP.Net Empty Web Site" from "File" -> "New" -> "Project..." -> Web Site.``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the code block ``` with inline code `
It is making the rest of the file format weirdly.
the application. | ||
|
||
###### Getting Started: Write Code | ||
Add a class file and give a name, here the example **“MainModule.cs"** has the following lines of codes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"following lines of code"?
The next code block environment is about the classes in the project.
} | ||
} | ||
``` | ||
A small change could be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small change to MainModule.cs?
``` | ||
using Nancy; | ||
using System; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
Once NuGet is installed, open: | ||
`"Package Manager Console" from "Tools" -> "Library Package Manager"` and run the following commands one after another. We can select the default project to which the installation should happen. | ||
|
||
`PM > Install-Package Nancy` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing
PM > Install-Package Nancy.Hosting.Aspnet
## Getting Started: Run the application | ||
It's done, now just hit F5. | ||
``` | ||
Output 1 -> Get["/"], pointing to the root folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no method defined for root directory /
404 Not Found
## Test POST, PUT and DELETE with Fiddler | ||
|
||
###### Step 1: | ||
>In Composer: Select `POST` and put `http://localhost:52961/person` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port is not always the same number
* For POST method: | ||
``` | ||
Request Body | ||
:{"Name":"Andrea","Lastname":"Shaw3","Birthdate":"Inflated3",”Weight”:85.5, “Height”:1.72} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The : symbol is not part of the request body
|
||
###### Step 1: | ||
>In Composer: Select `POST` and put `http://localhost:52961/person` or | ||
Select `PUT` and put `http://localhost:52961/person/id` or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id is a variable here, not the string "id"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Se han implementado los 6 endpoints requeridos:
Get["/person"] = Personlist;
Get["/person/{id}"] = PersonId;
Get["/person/{id}/health-profile"] = PersonHealth;
Post["/person"] = PostPerson;
Put["/person/{id}"] = PutPerson;
Delete["/person/{id}"] = DeletePerson;
El único punto débil de este tutorial, es que no se explican muy bien las configuraciones del entorno de trabajo (El visual tiene una cantidad casi infinita de posibilidades para diferentes entornos de desarrollo).
Otro punto que se podría mejorar, sería agregar algún tipo de conexión con alguna base de datos para poder hacer mas real el tutorial e incluir algun tipo de validador de datos de entrada (que es casi imprescindible al desarrollar web services).
No description provided.