Merry and Bright with Azure Advocates’ 25 Days of Serverless

Jen Looper - Nov 19 '19 - - Dev Community

This article is part of #25DaysOfServerless. New challenges will be published every day from Microsoft Cloud Advocates throughout the month of December. Find out more about how Microsoft Azure enables your Serverless functions.

Get ready for the holidays with Azure Advocates!

Dear Santa,

I have been very, very good this year. I only broke production once, I fixed several bugs, not all of them my own, I did not deploy on Friday EVEN ONCE, and I made my bed every morning. Instead of coal this year, could you consider helping me understand what serverless means? I think it has to do with the cloud, and I figure, since you fly around frequently with reindeer, you might know something about it.

Sincerely,

Hopeful Developer


Santa's Directive

Dear Hopeful Developer,

It does indeed seem that you’ve been good this year! You’re also in luck, because my special elves at Microsoft, who call themselves ‘Azure Advocates’ even though they often wear red, have created a very special treat for you! They are calling it “25 Days of Serverless”, and you’ll be able to learn all kinds of things about serverless technology by means of creative puzzles and fun activities. All you have to do is visit 25daysofserverless.com to learn all about it. Get ready for the first puzzle on December 1st!


25 Days of Serverless

Here at Microsoft, we are very excited about serverless technologies and all the many ways people have of leveraging the cloud to scale their businesses. Microsoft Azure, for example, can “turn ideas into solutions with more than 100 services to build, deploy, and manage applications—in the cloud, on-premises, and at the edge—using the tools and frameworks of your choice.”

We’re launching 25 Days of Serverless as a way for you to explore – any way you like – the promise and potential of serverless technologies. Over the month of December, you’ll be able to tackle all kinds of challenges that you can solve any way you like; we’ll offer solutions built on Azure, of course, but we’re curious how you would approach the problems we will present to you.

We look forward to your submissions!

Send 'em in!

The Premise

Oh no! An evil grinch has stolen all of the world's servers! Travel around the world helping everyone replace their current solutions to common tasks with serverless technology in time for the holiday rush.

Each day's puzzle will bring you to a new location somewhere in the world! You'll be helping local folks in that location with some problem they have, showing how moving to serverless can help things get done!

Rules

Solve the daily challenge in the programming language of your choice. Then submit your solution via GitHub (and share it on Twitter). We'll showcase the best solutions every week - and you might even have it featured in our video recap! Are you new to serverless? No problem - we'll have hints to help you! All you need is a GitHub account to post your solution and a sense of adventure.

For example, if you’ve decided to solve a challenge like this:

Little Elsie has a problem. She wants to tell Santa about the things she wants as gifts, but she is out of both paper, pencils, and stamps to write a quick letter! Wouldn't it be easier if she could create an API to allow Santa to access her requests?

This looks like a job for a custom API using Azure functions. In JavaScript, an endpoint to post requests into a Mongo database might look like this:

/**
 * File: CreateGift/index.js
 * Description: file responsible for creating a new 'Gift'
 * Data: 11/16/2019
 * Author: Glaucia Lemos (@glaucia86)
 */

const createMongoClient = require('../shared/mongo');

module.exports = async function (context, req) {
  const gift = req.body || {}

  if (!gift) {
    context.res = {
      status: 400,
      body: 'Gift data is required! '
    }
  }

  const { db, connection } = await createMongoClient()

  const Gifts = db.collection('gifts')

  try {
    const gifts = await Gifts.insert(gift)
    connection.close()

    context.res = {
      status: 201,
      body: gifts.ops[0]
    }
  } catch (error) {
    context.res = {
      status: 500,
      body: 'Error creating a new Gift'
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

But you don't have to submit your solution using JavaScript; any way you like to build is fine with us! You don't even have to use Azure, but we love it if you do!

Light it up!

Get Ready for 25 Days of Serverless Beginning December 1!

Watch for surprises all during December as we kick off the 25 Days of Serverless. Stay tuned here on dev.to as we feature challenges and solutions! Sign up for a free account on Azure to get ready for the challenges!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player