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
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# .NET nanoFramework WebServer
2
2
3
-
This is a simple nanoFrmaework WebServer. Features:
3
+
This is a simple nanoFramework WebServer. Features:
4
4
5
5
- Handle multithread requests
6
6
- Serve static files on any storage
@@ -19,7 +19,7 @@ Limitations:
19
19
20
20
## Usage
21
21
22
-
You just need to specify a port and a timeout for the querries and add an event handler when a request is incoming. With this first way, you will have an event raised every time you'll receive a request.
22
+
You just need to specify a port and a timeout for the queries and add an event handler when a request is incoming. With this first way, you will have an event raised every time you'll receive a request.
23
23
24
24
```csharp
25
25
using (WebServerserver=newWebServer(80, HttpProtocol.Http)
@@ -46,7 +46,7 @@ using (WebServer server = new WebServer(80, HttpProtocol.Http, new Type[] { type
In this example, the `RoutePostTest` will be called everytime the called url will be `test` or `Test2` or `tEst42` or `TEST`, the url can be with parameters and the method GET. Be aware that `Test` won't call the function, neither `test/`.
74
+
In this example, the `RoutePostTest` will be called every time the called url will be `test` or `Test2` or `tEst42` or `TEST`, the url can be with parameters and the method GET. Be aware that `Test` won't call the function, neither `test/`.
75
75
76
76
The `RouteAnyTest`is called whenever the url is `test/any` whatever the method is.
77
77
78
78
There is a more advance example with simple REST API to get a list of Person and add a Person. Check it in the [sample](./WebServer.Sample/ControllerPerson.cs).
79
79
80
80
**Important**
81
81
* By default the routes are not case sensitive and the attribute **must** be lowercase
82
-
* If you want to use case sensite routes like in the previous example, use the attribute `CaseSensitive`. As in the previous example, you **must** write the route as you want it to be restonded too
82
+
* If you want to use case sensitive routes like in the previous example, use the attribute `CaseSensitive`. As in the previous example, you **must** write the route as you want it to be responded to.
83
83
84
84
## A simple GPIO controller REST API
85
85
@@ -169,16 +169,16 @@ With the previous example the following happens:
169
169
170
170
- All the controller by default, even when nothing is specified will use the controller credentials. In our case, the Basic authentication with the default user (topuser) and password (topPassword) will be used.
171
171
- When calling http://yoururl/authbasic from a browser, you will be prompted for the user and password, use the default one topuser and topPassword to get access
172
-
- When calling http://yoururl/authnone, you won't be prompted because the authentication has been overrided for no authentication
172
+
- When calling http://yoururl/authnone, you won't be prompted because the authentication has been overridden for no authentication
173
173
- When calling http://yoururl/authbasicspecial, the user and password are different from the defautl ones, user2 and password is the right couple here
174
-
- If you would have define in the controller a speicif user and password like `[Authentication("Basic:myuser mypassword")]`, then the default one for all the controller would have been myuser and mypassword
175
-
- When calling http://yoururl/authapi, you must pass the header `ApiKey` (case sensitive) with the value `superKey1234` to get authorized, this is overriden the default Basic authentication
176
-
- When calling http://yoururl/authdefaultapi, the defautl key `ATopSecretAPIKey1234` will be used so you have to pass it in the headers of the request
174
+
- If you would have define in the controller a specific user and password like `[Authentication("Basic:myuser mypassword")]`, then the default one for all the controller would have been myuser and mypassword
175
+
- When calling http://yoururl/authapi, you must pass the header `ApiKey` (case sensitive) with the value `superKey1234` to get authorized, this is overridden the default Basic authentication
176
+
- When calling http://yoururl/authdefaultapi, the default key `ATopSecretAPIKey1234` will be used so you have to pass it in the headers of the request
177
177
178
178
All up, this is an example to show how to use authentication, it's been defined to allow flexibility.
0 commit comments