New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

rastapi

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rastapi

Fast and easy-to-use API maker made for JavaScript

latest
Source
npmnpm
Version
0.0.6
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

RastAPI

Fast and easy-to-use API maker made for JavaScript

Usage

Setup

  • CommonJS
require("rastapi");
  • Module
import RastAPI from "rastapi";

Create Server

  • HTTP
const server = new $rast.httpServer();
  • HTTPS
const server = new $rast.httpsServer();

Listening on port

server.listen(80).then(() => console.log("I am listening on port 80 ✨"));

Create Page

  • GET with an object
$rast.get("/");
server.json(() => {
    return {
        "message": "Hello World ✨"
    };
});
  • GET with a file
$rast.get("/myfile");
server.file(() => "./myfile.json");

Using url variables

$rast.get("/test/:test");
server.json(res => {
    return {"message": "You are in /test/" + res.getVariables().test};
});

Using url query

$rast.get("/test");
server.json(res => {
    return {"message": "You have successfully entered!", "query": res.getQuery()};
});

Not found page

$rast.notFound();
server.json(() => {
    return {"message": "Not Found 🙁"};
});

Set icon

$rast.Icon.createFromURL("https://i1.sndcdn.com/avatars-000389897325-h3s225-t500x500.jpg")
    .then(img => server.setIcon(img))
    .catch(err => console.error(err));

Keywords

api

FAQs

Package last updated on 04 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts