CSharpRepl
CSharpRepl is a web api for C# REPL using the Roslyn Scripting APIs
Install / Use
/learn @discord-csharp/CSharpReplREADME
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 -->Getting Started
Clone and open the project in your favorite IDE/Editor!
Prerequisites
- Install Visual Studio Code, Visual Studio 2019, or Rider
- Install the dotnet SDK
- Install Docker
- (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 EXAMPLES -->
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 -->
Roadmap
See the open issues for a list of proposed features (and known issues).
<!-- CONTRIBUTING -->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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - 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 -->