This morning I wrote on how to install monodevelop and now I will make my first website using monodevelop.

First thing to do when you work with monodevelop is to install the nuget-plugin.

Now create a VB.Net ConsolApplication.

And then we can go look for Nancy.Hosting.Self via Project > Add Packages

Screenshot from 2014-06-24 14:48:58

Add that to your project.

And now it is time for some code.

First we make sure we start our host. In the Application.vb file.

vb.net
1
2
3
4
5
6
7
Public Class Application
  Public Shared Sub Main()
    Dim host = New Nancy.Hosting.Self.NancyHost(New Uri("http://localhost:1234"))
    host.Start()
    Console.ReadLine()
  End Sub
End Class
Public Class Application
  Public Shared Sub Main()
    Dim host = New Nancy.Hosting.Self.NancyHost(New Uri("http://localhost:1234"))
    host.Start()
    Console.ReadLine()
  End Sub
End Class

And then we add an EmptyFile and add this code to it.

vb.net
1
2
3
4
5
6
7
8
9
10
11
12
Public Class SampleModule 
    Inherits Nancy.NancyModule
 
    public Sub New()
        Me.Get("/") = AddressOf Hello
    End Sub
 
    Public Function Hello(ByVal parameters as Object) As String
        Return "Hello world"
    End Function
 
End Class
Public Class SampleModule 
	Inherits Nancy.NancyModule

    public Sub New()
    	Me.Get("/") = AddressOf Hello
    End Sub

    Public Function Hello(ByVal parameters as Object) As String
    	Return "Hello world"
    End Function

End Class

And now open a browser and go to http://localhost:1234/

And magic.

Screenshot from 2014-06-24 14:54:41

Did you see the no frills VB.Net? It work but it is lightyears behind VB.Net on windows.