-
Notifications
You must be signed in to change notification settings - Fork 52
8) Server (WebApi)
The Server is a asp.net mvc solution. MVC is a world class open source web framework developed by Microsoft. I chose it because it is fast, scalable and written in C#. You should have a basic understanding of how to develop with this technology before you begin. I also recommend using at least Visual Studio 2013 as your IDE.
- http://www.asp.net/mvc/overview
- https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
You will also need a webhost to host the solution on the world wide web. Most any host that supports windows and mssql will do. I have tested this package on cheap $2 a month hosting as well as Azure.
Lastly, the next iteration of MVC (vNext) will support hosting on Linux web servers as well as new data providers (Monogo, msql). I will update the package when this is released.
The webserver has a number of dependencies. These must be loaded using nuget. Right click on the solution file in the solution view and select Manage Nuget Packages For This Solution. You will be prompted to restore missing packages. Once complete rebuild the package and any missing reference exceptions will be remedied.
In the root there a ql generation script : Foundation.sql. Running this script will generate the sql tables. You may run these scripts together if you wish to use a single database.
You will need to setup DB migrations. This is controlled by the Global.asax.cs file. By default it is set to "drop and recreate the database" every time it runs. You will need to replace this functionality in production.
There are a number of settings that must be configured in the web.config.
The Connection string AppDatabase defines how you connect to the database. By default, it is set to use the db file in the App_Data folder. In production you will need to point this to the ip address of your db server.
There are a number of appSettings, most of which you may ignore. I will point out the important ones.
- AesKey : Key used to encrypt user passwords. (AED 256)
- AdminPassword : Default password of Admin user (create on installation).
- AdminEmail : Default username / email of Admin user (create on installation).
- Mail : Settings for the email service.
Information for logging into your host's outgoing smtp mail server. For hosting on Azure I recommend using http://sendgrid.com as an smtp provider.
Now the application is setup and you are good to run and/or deploy the app.
Email templates are defined in razor syntax. This is an html-esq markup language. You can find these files under Root/Views/Mailer.