Get Started
To build the Scrapbook101 app on Windows use the following:
Install these components on your development or local server. This server will be your local run/test environment as well as the publish point to push changes live, if you choose to do so.
Visual Studio has different workloads that can be installed. If you are running Scrapbook101 on ASP.NET for Windows, then you need the ASP.NET and web development workload. If you are running Scrapbook101 on ASP.NET Core, then you need the .NET Cross-platform development workload. For more information on workloads, see Selecting Workloads in Visual Studio 2017.
After installing the Cosmos DB Emulator, confirm that you can run Cosmos DB Local Emulator. You should see a screen like the following image.
Run local
Running Scrapbook101 locally, you can try out your ideas at no cost or risk.
- Clone (https://github.com/travelmarx/scrapbook101.git) or download the Scrapbook101 code and open it as a solution in Visual Studio. The source code in the
src
folder and these docs in thedocs
folder. - Open the solution in Visual Studio. For example, open the solution file
Scrapbook101.sln
. - Customize the code as follows in the
web.config
file.- Enter the correct value for authKey, which you can get from the local emulator home page as show above.
- Enter a Bing Maps Key for bingMapKey if you have one; if blank, then geocoding is skipped.
- Set the value for addTestAssets to
true
to write test assets orfalse
not to write them.
web.config
settings you can change, but the the three above are the enough to get started.
- Clone (https://github.com/travelmarx/scrapbook101core.git) or download the Scrapbook101 code and open it as a solution in Visual Studio. The source code in the
Scrapbook101core
folder. - Open the solution in Visual Studio. For example, open the solution file
Scrapbook101core.sln
. - Customize the code as follows in the
appsettings.json
file.- Enter the correct value for AuthKey, which you can get from the local emulator home page as show above.
- Enter a Bing Maps Key for BingMapKey if you have one; if blank, then geocoding is skipped.
- Set the value for AddTestAssets to
true
to write test assets orfalse
not to write them.
appsettings.json
settings you can change, but the the three above are the enough to get started.
With the Cosmos DB Local Emulator running, run the solution (Visual Studio F5) and view Scrapbook101 in a browser, e.g. https://localhost:port#/. You should see something ressembling the following screenshot:
What happened on startup:
- In the document store, a database named Scrapbook101 was created with a collection named Items.
- A category document was created and stored in the document store. The category information was read from the file
Assets/categories-document.json
. - If the configuration option addTestAssets to create test assets was set to `true` in
the
web.config
file, then test items were added to the document store as well. They were read from the fileApp_data/categories-document.json
.
- In the document store, a database named Scrapbook101 was created with a collection named Items.
- A category document was created and stored in the document store. The category information was read from the file
Assets/categories-document.json
. - If the configuration option AddTestAssets to create test assets was set to `true` in
appsettings.json
, then test items were added to the document store as well. They were read from the fileAssets/categories-document.json
.
Create an item
At this point, you can start working with Scrapbook101 items with CRUD (create, read, update, delete) operations. The home page is https://localhost:port#/ or https://localhost:port#/Item/Index.
To create a new Scrapbook101 item.
- On the home page, select Create.
- Choose a category in the Category dropdown.
- Fill in the Title field.
- Select Save or continue to fill in fields.
Run live
After running Scrapbook101 locally, you can take optional next step and run Scrapbook101 as a web service. To do this you need to go live, which means publishing your site live with the following services:
-
Azure Cosmos DB Service - This works the same as local emulator and you can copy any documents created locally to the live service.
-
Azure Application Service - You can publish your site directly from Visual Studio to the Azure Application service.
Using Azure Cosmos DB Service you will eventually incur charges, but be sure to take advantage of any limited, free use offers.
There are a couple of other considerations when going live. In the least, you should consider:
- Authentication and authorization.
- Transfering any documents from local emulator to live service.
- How to deal with asset storage.
These and other topics are discussed in Next Steps and Handling Assets.