Giter VIP home page Giter VIP logo

axum-service-checklist's Introduction

Axum service checklist

make build debug=1 # cargo build
make build # cargo build --release

Checklist

First step is uncommenting the tests in the workflows, check out .github/workflows/ci.yml.

  • Create a hello word route on GET:/hello-word and write tests for it. Check out the src/test.rs file. It should return simply:
hello world
  • Serve static files by serving the folder resources. Should be able to access http://localhost:3000/static/great-wave.jpg and return the image file:

Demo great wave

Cors

  • Create a middleware to extend the headers and add a new header with a key as "animal" and value as random value between: "dog", "cat", "monkey" and "sloth".

Headers

  • Implement a route GET:/user that parses a local JSON file user.json and returns a response with content-type "application/json" and with the body as:
{
	"name": "Emil",
	"age": 7,
	"email": "[email protected]"
}
  • Implement a route GET:/users that parses a local JSON file users.json and returns a response with content-type "application/json" and with the body as:
[
	{
		"name": "Emil",
		"age": 7,
		"email": "[email protected]"
	},
	{
		"name": "Pipi",
		"age": 8,
		"email": "[email protected]"
	}
]
{
	"dog": "https://images.dog.ceo/breeds/malinois/n02105162_299.jpg"
}
  • Implement a route GET:/dog?download=true that makes a request to https://dog.ceo/api/breeds/image/random , parses the response and download the image to the resources folder and return the path in the response body, example:
{
	"dog": "http://localhost:3000/static/malinois/n02105162_299.jpg"
}

Working with repo

We use Make as a primary build tool. Here are the most important commands, others you will find in Makefile.

make build

Installs dependencies and build it.

make docker-build

Builds a Docker image for the service.

make test

Runs all the test suits: API, integration and unit tests.

axum-service-checklist's People

Contributors

raphamorim avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

siimon

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.