npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

arco.server

v0.0.44

Published

Arco is a server web

Readme

Arco

Arco é um servidor web.

Como executar

No terminal execute o comando abaixo:

arco .
  • Definindo outro diretorio
arco /web/app
  • Descobrindo outros comandos
arco --help

link

cria um link simbolico para um diretório.

  • Exemplo:
    • dir1/subdir1
    • dir2/subdir2
    arco --link "@/:./dir1" --link "$:./dir2"
  • URL: http://site/@/subdir1
  • URL: http://site/$subdir1

Options file

É possivel informar alguma forma de comportamento utilizando arquivos de configuração semelhante ao .htaccess do apache.

Exemplo:

  • Arquivo: .arco.json
{
    "rewrite":true,
    "hidedir":true, 
    "headers":{
        "X-SERVER":"My Server"
    }
}
  • Atribudos disponiveis:

Atributo | valor | Descrição | Exemplo -------- | --- | --- rewrite | true,false,"force" | Ativa a reescrita de url hidedir | true,false | Oculta listagem de diretórios rewriteMatch | string | template de URL | "/api/projects/:project/plugins/:plugin" rewriteMatchStrict | true,false | compara exatamente a URL headers | object | Headers | {"X-SERVER":"My Server"}

Execute scripts

O servidor suporta as seguintes linguagens:

- javascript
- bash

Para executar um arquivo de linguagem especifica, basta retornar o conteudo diretamente.

  • Bash - simples:
# @server-execute
echo 'Hello World!'
  • Javascript - simples:
// @server-execute
console.log('Hello World!');

É possivel definir respostas personalizadas, como o codigo HTTP e headers da requisição, porem a saida do arquivo executado deve seguir o padrão:

[::JSON_RESPONSE::]
  • Bash:
# @server-execute
echo '[::{"body":"123","code":203}::]'
  • Javascript
// @server-execute
import {request, output, files} from "arco";
output( 'Hello World!' ,{
    "headers":{
        "Content-Type": "application/json"
    }
});

Retornar ao client respostas pre-definidas

Altere o parametro "template" para uma das strings disponiveis (error, notfound, forbidden). Em "message" defina um texto para exibir na pagina..

import {request, output, files} from "arco.server";
output( request() ,{
    "defaultResponse":{
        "template":"error",
        "message":"aaa2"
    }
});

Response with image buffer

import {request, output, files} from "arco.server";
output( files(0).buffer ,{      
        "headers":{
            "Content-Type": files(0).mimetype
        }
    }); 

Stream

.arco.json

{
    "headers":{       
        "Content-Type": "text/event-stream",
        "Cache-Control": "no-cache",
        "Connection": "keep-alive"
    }
}
import {request, output, files} from "arco.server";
let count = 0;
let time = setInterval(()=>{
    count++;    
    if(count >=4){
        clearInterval(time);
        output( count );
        return;
    }    
    output( count );
},1000);

Inject

  • .arco.json
{
    "inject":[
        {
            "filematch":"test.html",
            "content":"<script>alert('inject html start')</script>",
            "location":"head-start"
        },{
            "filematch":"*.*",
            "content":"<script>alert('inject html end')</script>",
            "location":"head-end"
        },{         
            "filematch":"*",
            "content":"<script>alert(2)</script>",
            "location":"body-start"
        },{         
            "filematch":"*",
            "content":"novo-texto",
            "location":"/texto(.*?)/"
        }
    
    ]
}
  • parametros disponiveis:

    • filematch: nome do arquivo
    • content: conteúdo a ser injectado
    • location: local de inject(head-start|head-end|body-start|body-end|full|regex)

urlMatch

Cria match de url para o script index onde o .arco.json esta localizado. Disponibiliza também o parametro "params" com os valores de url.

  • .arco.json
{
    "urlMatch":{
        "session":["/api/session/:session"],
        "database":[
            "/api/database/:database/minhabase/*:path",
            "/api/database/:database/minhabase2/:id/abc"
        ]
    }
}
  • index.js
import {request, output} from "arco.server";
let {urlMatch} = request();

if(urlMatch.session){
    let {session} = urlMatch.session.params;
    let response = await axios.get('http://domain/session/'+session);

    output( response.data );
    return;
}

output( null ,{
    "defaultResponse":{
        "template":"notfound",
        "message":"Custom Not Found Message"
        "output":"Message on page"
    }
});

Routes

  • .arco.json
{
    "onlyroutes":true,
    "routes":{
        "GET:/api/session/:session":{"target":"api/database/index.js"},
        "POST:/api/database/:database/minhabase/:id":{"target":"api/database/index.js"},
        "GET:/api/database/:database/minhabase/*id":{"target":"api/database/index.js"}
    }
}
  • parametros disponiveis:

    • onlyroutes: define se o servidor deve responder apenas as rotas - (true,false)

    • routes: define as rotas

      "[METHOD]:[ROUTE]": {"target":[SCRIPT_FILE]}

Set compiler/transpiler

  • .arco.json
{
    "compiler":{
        "javascript":"/home/user/.bun/bin/bun"
    }
}