Skip to content

Commit

Permalink
feat: adding script for http server and cargo-watch management
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemin-n committed Sep 20, 2023
1 parent c355deb commit 2ec1c63
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 20 deletions.
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@
</p>

## 🤝🏼 Agrega tu articulo

Pasos:

- Haz fork de este proyecto
- Crea un archivo Markdown en la carpeta `articles`
- Escribe tu articulo con este formato
```md
---
title: Mi Articulo
description: La descripcion de mi articulo
author: RustLangES
github_user: RustLangES
date: 2023-09-17
tags:
- rust
- comunidad
# Aqui compartes tus redes sociales
social:
github: https://github.com/RustLangES
# twitter:
# website:
---

El Contenido de tu articulo
```

```md
---
title: Mi Articulo
description: La descripcion de mi articulo
author: RustLangES
github_user: RustLangES
date: 2023-09-17
tags:
- rust
- comunidad
# Aqui compartes tus redes sociales
social:
github: https://github.com/RustLangES
# twitter:
# website:
---

El Contenido de tu articulo
```

- Haz una PR con tus cambios
- Espera nuestra revision
- Disfruta de tu articulo publicado 🎊
Expand All @@ -38,15 +42,27 @@ Pasos:
# Desarrollo

## Requisitos

- [Rust](https://rust-lang.org/tools/install)
- [NodeJs](https://nodejs.org)
- [cargo-watch](https://crates.io/crates/cargo-watch)

## Ejecutar

```
# generar la web
cargo watch -x run --shell "npx tailwindcss -i ./input.css -o ./out/output.css && cargo run"

# lanzar un servidor web provicional con python3
python3 -m http.server -d out
python3 -m http.server -d out
```
```
# En cualquier linux distro

## Iniciar cargo watch y http server
./server start

## Apagar ambos servicios
./server stop
```
14 changes: 14 additions & 0 deletions server
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

if [ "$1" = "start" ]
then
nohup cargo watch -x run --shell "npx tailwindcss -i ./input.css -o ./out/output.css && cargo run" &
nohup python3 -m http.server -d out &
fi

if [ "$1" = "stop" ]
then

kill -9 $(sudo netstat -npl --inet | awk '/:8000/' | awk -F "[ /]+" '{print $7}')
pkill cargo-watch
fi

0 comments on commit 2ec1c63

Please sign in to comment.