Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Focusing

Gianmarco Ladvace

:octocat:
Focusing
View GitHub Profile
View [slug].svelte
<script context="module">
export async function load({ fetch, page }) {
let article;
try {
// here we are gonna fetch the single article by id
article = await fetch(`https://dev.to/api/articles/${page.params.slug}`);
article = await article.json();
} catch (e) {
View index.svelte
<script context="module">
// this script fetch the posts from the api
// https://svelte.dev/docs#script_context_module
// this is runned on load (check svelKit doc)
export async function load({ fetch }) {
let articles;
try {
// here you should type your dev.to username
View gist:2696336bf36c8259b82189273dc93c6f
const stringio = require('@rauschma/stringio');
const child = require('child_process');
const start = child.spawn(`java -Xms512M -Xmx1024M -jar ./TEST-FILE.jar`,
[], { shell: true });
async function writeToWritable(writable, data) {
console.log("WRITABLE", writable);
//await stringio.streamWrite(writable, data);