Skip to content

jakke-korpelainen/az-fn-rust-http-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Function (HTTP) with Rust serving HTML

Simple barebones blog that pulls data from contentful space. Might add a /frontend into this to demonstrate mixing rust and js in the same project.

Built with

Azure Functions, Rust, Contentful

Rust dependencies

axum, askama, contentful, tokio, reqwest, serde, tower_http

Prequisites

Demo

https://jakke-fi-function.azurewebsites.net/

Instructions

Configurations

Envs

CONTENTFUL_SPACE_ID= # Your contentful space id to pull data from
CONTENTFUL_ACCESS_TOKEN= # Your contentful access token for the space

Contentful Data Model for Blogs

The parsing expects the blog posts to be in the following format:

pub struct BlogPost {
    pub title: String,
    pub slug: String,
    pub content: String,
    pub tags: Option<Vec<String>>,
}

and be typed as blogPost in contentful. See src/posts.rs for more details.

Running the cargo

  1. cargo run
  2. See http://localhost:3000

Running locally the Azure Function

  1. release.sh builds the project and copies handler.exe into folder root.
  2. func start
  3. See http://localhost:7071

About

Azure Function in which rust serves html thru http

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published