Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
express-tsx
Advanced tools
这是 express 中 jsx 模板渲染的一个实现 .
它提供了两种渲染模式 , 一种 "静态渲染" , 一种 "服务器同构渲染"
调用 ReactDOM.renderToStaticMarkup
方法渲染 require('tsxmodule').default || require('tsxmodule')
import Express = require('express')
export const app = Express()
import { render } from "express-tsx";
app.engine('.tsx',render())
app.set('views',__dirname+'/views')
app.set('view engine','tsx')
app.get('/',(req,res)=>res.render('staticHTMLRender',{ who:'express-tsx', title:'express-tsx' }))
export default (props)=>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{props.title}</title>
</head>
<body>
hello {props.who}
</body>
</html>
这个的实现就比较绕了 , 建议直接看 源码
import Express = require('express')
export const app = Express()
<<<<<<< HEAD
import { render,middleware } from "express-tsx";
app.use(middleware)// 这步很重要
app.engine('.tsx',render({ ssr:true }))
app.set('views',__dirname+'/views')
app.set('view engine','tsx')
app.get('/',(req,res)=>res.render('ssrRender',{ who:'express-tsx', title:'express-tsx' }))
export default (props)=>
<div onClick={ ()=>alert(props.who) }>
hello {props.who}
</div>
git clone https://github.com/shynome/express-tsx.git
npm install
npm test
FAQs
express view engine to render tsx file
The npm package express-tsx receives a total of 3 weekly downloads. As such, express-tsx popularity was classified as not popular.
We found that express-tsx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.