Skip to content

CSharpRepl is a web api for C# REPL using the Roslyn Scripting APIs

License

Notifications You must be signed in to change notification settings

discord-csharp/CSharpRepl

Repository files navigation

Contributors Forks Issues MIT License Build Status


Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

CSharpRepl is a web service that provides C# interactive features over http. This service was developed to provide REPL capability in the C# Discord via the MODiX Discord Bot.

Getting Started

Clone and open the project in your favorite IDE/Editor!

Prerequisites

  1. Install Visual Studio Code, Visual Studio 2019, or Rider
  2. Install the dotnet SDK
  3. Install Docker
  4. (Optional) Install docker-compose

Installation

Note: The container will cleanly exit after every request, or after 30 seconds with an active request. Use --restart=always to ensure the container remains available. Command line:

docker run -d --user www-data --restart=always --read-only --tmpfs /tmp --tmpfs /var --memory 500M --cpus 2 -p 31337:31337 -e ASPNETCORE_URLS=http://+:31337 ghcr.io/discord-csharp/csharprepl:latest

Docker Compose:

version: '3.7'
services:
  repl:
    image: ghcr.io/discord-csharp/csharprepl:latest
    restart: always
    read_only: true
    user: www-data
    environment: 
      - ASPNETCORE_URLS=http://+:31337
    ports:
      - '31337:31337'
    tmpfs:
      - /tmp
      - /var

Usage

curl -X POST -H 'Content-Type: text/plain' -d 'Console.WriteLine("Hello World");' http://localhost:31337/eval
Invoke-WebRequest -UseBasicParsing -ContentType text/plain -Method POST -Body "Console.WriteLine(`"Hello World`");" -Uri http://localhost:31337/eval | Select-Object Content

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Chris Curwick - @Cisien on Discord

Project Link: https://github.com/discord-csharp/CSharpRepl

Acknowledgements

About

CSharpRepl is a web api for C# REPL using the Roslyn Scripting APIs

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages