Code Monkey home page Code Monkey logo

nancy-simple-heroku's Introduction

A simple C# app that deploys to Heroku in one step

This repo contains a bare-bones, self-hosting Nancy app prepared for deployment on Heroku. All you have to do to get a C# web app deployed on Heroku is:

$ rake init

All of the heavy lifting was done by Ben Hall; the goal of this fork is simply to collect and document Ben's hard work to make it even easier to create simple C# apps on Heroku.

First Steps

First off, you need to get Mono, create a Heroku account, and install the Heroku toolbelt if you haven't already. Then, to create a new Heroku app, deploy your app to Heroku, and open it in your browser, simply do:

$ rake init

You should only run rake init once. When Heroku creates a new app, it assigns a unique hostname to your app–something like stark-hollows-8350.herokuapp.com. rake init reads this hostname and saves it as a Heroku environment variable, which the Nancy app reads to bind to the correct URL. If you ever change your Heroku hostname, remember to update HOST:

$ heroku config:add HOST=<your new hostname>

Building

$ rake build

Running your app locally

$ rake stage # or just `rake`

Deploying to Heroku

This is merely a shortcut for git push heroku master:

$ rake deploy

Rationale

I'm a developer who uses OS X and loves how easy Heroku makes web app deployment. Heroku's path of least resistance is to use Rails or Node to create your web app, and while I adore CoffeeScript and have some experience writing web apps with Rails and Express, sometimes I want to write my web app in a statically-typed language.

I'm a huge fan of the Mono project, and want to run web apps on Mono, but I've always found .NET web app configuration and deployment overly complicated, especially since I don't use Windows or Visual Studio as my main development environment, and I want something 'lighter' than ASP.NET for simple web services.

Nancy is a Sinatra-esque DSL in C# for creating web apps, and Ben Hall created a Heroku buildpack for Mono and blogged about running Nancy on Heroku about a year ago. I've collected bits of information from Ben's blog posts and added a Rakefile to make the process of deploying this tiny app a little easier.

Enjoy!

nancy-simple-heroku's People

Contributors

dvdsgl avatar benhall avatar

Watchers

Abdul Hadad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.