Skip to content

About A simple HTTP server implemented in TypeScript uses Deno as runtime. This is for Docker's official Deno Language Guide

License

Notifications You must be signed in to change notification settings

Pradumnasaraf/deno-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple HTTP server build with TypeScript and Deno as a runtime to serve a simple JSON response. This is for Docker's Deno Language Guide.

API

The server only supports the HTTP GET method at the moment. When a GET request is received, the server responds with a JSON object:

{
    "message": "OK"
}

Running with Docker Compose

Below is the Dockerfile for the our server:

# Use the official Deno image
FROM denoland/deno:latest

# Set the working directory
WORKDIR /app

# Copy server code into the container
COPY server.ts .

# Set permissions (optional but recommended for security)
USER deno

# Expose port 8000
EXPOSE 8000

# Run the Deno server
CMD ["run", "--allow-net", "server.ts"]

To run this application using Docker Compose, you'll need to create a compose.yml file.

Here's the compose.yml file:

services:
  server:
    image: deno-server
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8000:8000"

To build and run the Docker image using Docker Compose, use the following command:

docker compose up

This will build the Docker image and then run it, mapping the container's port 3000 to port 3000 on the host machine. You can then access the API by visiting http://localhost:3000 in your web browser.

Contributing

Any feedback and contributions are welcome! Please open an issue before submitting a pull request.

License

MIT License

About

About A simple HTTP server implemented in TypeScript uses Deno as runtime. This is for Docker's official Deno Language Guide

Topics

Resources

License

Stars

Watchers

Forks