Recently I have been trying out different frameworks like Ghost running on Azure Web Apps. I was trying to get away from just the standard ASP.NET or PHP solutions, branching out to Node.js or static site generators (more to come on that).
Harp
Harp is a Node.js / npm web platform that uses common template formats like Jade and Markdown to make it easier to author pages. Rather than providing a user interface for authoring, the process flow includes editing local files for content and layout.
Harp seems to be both a Static Site Generator and a Node.js hosting platform. For the purposes of this post I will be going through how to run Harp as a hosting platform.
Initialize Harp directory
harp init my-harp-app cd my-harp-app
Initialize your app as a Git repo
git init git commit -am "initial commit"
Create a new Azure Web App
Enable Continuous Deployment with a Local Git Repository
Copy the repository clone url and add it as a remote repository
git remote add azure https://user@my-harp-app.scm.azurewebsites.net:443/my-harp-app.git
Note:
my-harp-app
will be replaced by your site name.Add
package.json
andserver.js
{ "name": "harpapp", "version": "0.0.0", "private": true, "dependencies": { "harp": "0.19.0" }, "engines": { "node": "4.1.x", "npm": "3.5.1" } }
Then, use Node Package Manager to install the dependencies:
npm install
Next, create
server.js
, which should contain the following:require('harp').server(__dirname, { port: process.env.PORT || 5000 })
Create a
iisnode.yaml
file which should contain the followingnode_env: production
Commit any changes to Git
git commit -am "adding node files"
Deploy your Harp app to Azure
git push azure master
At this point your site should be running on Azure at http://my-harp-app.azurewebsites.net
, but with the subdomain you specifed instead of my-harp-app
.
This article shows you how to create and deploy your Harp application to Azure using the Azure Command Line Interface (
azure-cli
) tool.
Stay tuned for more articles on web platforms and static site generators like middleman, Jekyll, Hexo, and more.
Thanks for reading.
Comments