New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@xiara/web

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiara/web

Web Server framework using Express.js for Xiara

  • 0.0.11
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@Xiara/Web

Express.js based Web Server Framework for typescript, a complete toolset, decorators for rest apis and web applications.

Checkout the https://github.com/xiara-io/xiara-boilerplate for a complete Test Application

Installation

npm install @xiara/core --save npm install @xiara/web --save

App Structure

app-strucutre

Components

  • Components (Basic App components)
  • Controller (MVC Controllers)
  • Policy (Authenticaiton rules)
  • Middlewares (Express Middlewards)
  • Models (Database definitions)
  • Responses (HTTP Response definitions & Exceptions)
  • Service (Services)
  • Views (ejs or other template engine views)

A Controller

@Controller({ path: "/todos" })
class TodosController
{
    @GET("/getTodos")
    getTodos(req, res)
    {
      res.json({
        success: true
      })
    }
}

The above route defines the following HTTP end point GET /todos/getTodos

Policy

@Policy()
class AuthPolicy
{
    resolve(req, res, next)
    {
      // If logged in continue
      if(req.user)
      {
          return next();
      }
      res.forbidden("Login required");
    }
}

Responses

@Response("forbidden")
class ForbiddenResponse
{
    // Dependency Injection
    constructor(public logger: LogService)
    {
    }
    
    send(req, res, message: string)
    {
      res.status(500);
      return res.json({
        success: false,
        message: message
      })
    }
}

License

MIT

Quesitons? Problems? Bugs?

Please open an issue.

FAQs

Package last updated on 01 Aug 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc