Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-tsx

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-tsx

express view engine

  • 4.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33
increased by371.43%
Maintainers
1
Weekly downloads
 
Created
Source

介绍

express 视图引擎 tsx 的实现 .

安装

npm install express-tsx typescript --save

使用示例

主文件

//创建 express 服务
const express = require('express')
const server = express()
server.listen(9000,function(){ console.log(`server is running on ${this.addresss().port}`) })
//设定视图引擎
server.engie('.tsx',require('express-tsx').render)
server.set('views',__dirname)
server.set('view engie','tsx')//选择视图引擎
//**注意**:在渲染视图前需要根路由注入中间件
server.use(require('express-tsx').middleware)
//渲染视图
server.ues('/',(req,res)=>res.render('./view.tsx'))
import React = require('react')
alert('express-tsx' as any)
export default ()=>
<div>
  hello world
</div>

示例运行

  • 克隆本项目
    git clone https://github.com/shynome/express-tsx.git
    
  • 安装依赖
    npm install
    
  • 进入示例目录
    cd example
    
  • 运行
    npm start
    
  • 在浏览器中打开 示例:http://127.0.0.1:9000/
    一切正常的话会看到 : hello world

Keywords

FAQs

Package last updated on 15 Jul 2017

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