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

api-route

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-route

Basic framework for your API in Node.js

latest
Source
npmnpm
Version
0.0.15
Version published
Maintainers
0
Created
Source

Simple Route

Rápido, fácil de usar, construido en TS y sin opiniones

Crea tu api en en nodejs con lo mínimo que necesitas

Índice

  • Instalación
  • Uso

Instalación

npm install api-route

Uso

import { apiRouter } from 'api-route'

const app = apiRouter()

app.add('GET', '/', (): Response => {
  return new Response('Hello World')
})

app.add('GET', '/user/:id', ({ params }): Response => {
  const { id } = params
  return Response.json({ status: 'ok', id })
})

app.add('POST', '/user', async ({ request }): Promise<Response> => {
  const json = await request.json()
  return Response.json({ status: 'ok', body: json })
})

app.run(4221, 'localhost', () => {
  console.log(`🫶 Server is running on http://localhost:4221`)
})

Keywords

api

FAQs

Package last updated on 02 Jan 2025

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