A REST-API containing few important Java snippets.
{
"Version":"jSnip.json v1.0.7",
"Madeby":"TheDucky",
"simple_print": [
{
"snip":"public class Main {\n public static void main(String[] args) {\n\tSystem.out.println(\"Hello World!\");\n }\n}"
}
],
"switch_case": [
{
"snip":"switch(expression) {\n case x:\n //code block\n break;\n\n case y:\n //code block\n break;\n\n default:\n //code black\n}",
"example":"char swt = 'd';\n\nswitch(swt) {\n\n case 'd':\n System.out.println(\"char was = d\");\n break;\n\n case 'a':\n System.out.println(\"char was = a\");\n break;\n\n default:\n System.out.println(\"hmmm, it wasent a or d\");\n}"
}
],
"if_else": [
{
"snip":"if(condition) {\n //block of code to be exicuted if conditions are true\n}else {\n //block of code to be exicuted if conditions are false\n}",
"example":"int y = 101;\n\nif(y == 101) {\n System.out.println(\"y = 101\");\n}else {\n System.out.println(\"y is not = 101\");\n}"
}
],
}
import requests
raw = requests.get("http://127.0.0.1:5500/API/jSnip.json")
req = raw.json()
print("Status code:", raw.status_code)
print(req)
#! /bin/bash
data=$(curl 'http://127.0.0.1:5500/API/jSnip.json' -s)
echo $data