Giter Site home page Giter Site logo

reno-router / blog-microservice Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 104 KB

An example Reno microservice for creating and fetching blog posts from a PostgreSQL database

License: MIT License

TypeScript 97.16% Dockerfile 2.84%
deno reno microservice postgresql postgres postgresql-database docker docker-compose typescript testing-practices

blog-microservice's Introduction

Blog Microservice

CI

Notice

โš ๏ธ Reno has been sunset, and will thus no longer receive updates. The final version is v2.0.105, which supports Deno 1.34.3 and std 0.192.0.

It is recommended that you use an alternative routing library or HTTP framework, such as Oak or Opine.

Thank you to anyone who supported the project during its lifetime.

Reno: 2019-2023


An example Reno microservice for creating and fetching blog posts from a PostgreSQL database.

Running Locally

This repo includes a Docker Compose configuration and a dedicated Dockerfile for local development, which together will:

  • run a Postgres container, boostrapped with the provided SQL initialisation and seed scripts
  • create a local network that's shared by both the database and microservice containers
  • start the microservice via Denon, automatically restarting whenever the source code changes

If you haven't already, install Docker and Docker Compose, after which it's simply a case of running:

$ mv .env.sample .env
$ docker-compose up

The service will be available on port 8000, against which any of the requests under Operations can be made.

$ curl http://localhost:8000/posts

Developer Experience Protip

You can install the Deno dependencies and their accompanying TypeScript definitions onto your host machine by running deno cache deps.ts; this isn't a prerequisite to running the service, but will allow your TS-enabled editor to discover said definitions, vastly improving the local development experience.

Unit Tests

This project has extensive unit test coverage. The test suite can be invoked with deno test service.

Operations

GET /posts

Retrieves metadata for all of the posts in the database.

GET /posts/<UUID>

Retrieves the metadata and content of the post with the given UUID.

POST /posts

Adds a new post to the database.

Request body

{
  "title": "My new post",
  "contents": "Here's the content body of my post",
  "authorId": "<Author UUID>",
  "tagIds": ["<Tag UUID>", ..."<Tag UUID>"]
}

PATCH /posts/<UUID>

Replaces the contents property of the post with the given UUID.

Request body

{
  "contents": "Here's the updated content body of my post"
}

blog-microservice's People

Contributors

jamesseanwright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

afrknchld

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.