()
| 39 | }; |
| 40 | |
| 41 | const Server = () => { |
| 42 | const code = ` |
| 43 | import { handler, initBridge } from "bridge"; |
| 44 | import z from "zod"; |
| 45 | |
| 46 | const getName = handler({ |
| 47 | query: z.object({ name: z.string() }), |
| 48 | resolve: ({ query }) => ({ |
| 49 | name: query.name, |
| 50 | age: 21, |
| 51 | date: new Date(), |
| 52 | }), |
| 53 | }); |
| 54 | |
| 55 | const port = 8080; |
| 56 | |
| 57 | initBridge({ routes: { getName } }) |
| 58 | .HTTPServer() |
| 59 | .listen(port, () => { |
| 60 | console.log(\`Listening on port \${port}\`); |
| 61 | }); |
| 62 | `.trim(); |
| 63 | return ( |
| 64 | <div className="border-white md:border-r border-opacity-5"> |
| 65 | <div className="px-3 py-1.5 mt-3 ml-5 text-xs mb-3 text-white text-opacity-50 rounded-md max-w-max"> |
| 66 | Server |
| 67 | </div> |
| 68 | <Highlight {...defaultProps} theme={theme} code={code} language={'typescript'}> |
| 69 | {({ className, style, tokens, getLineProps, getTokenProps }) => ( |
| 70 | <pre |
| 71 | className={className} |
| 72 | style={{ |
| 73 | padding: '8px 20px', |
| 74 | marginBottom: 8, |
| 75 | background: 'transparent', |
| 76 | }} |
| 77 | > |
| 78 | {tokens.map((line, i) => ( |
| 79 | <div style={{ display: 'table-row' }} key={i} {...getLineProps({ line, key: i })}> |
| 80 | <div |
| 81 | style={{ |
| 82 | fontSize: 14, |
| 83 | display: 'table-cell', |
| 84 | textAlign: 'right', |
| 85 | userSelect: 'none', |
| 86 | opacity: 0.5, |
| 87 | paddingRight: '1em', |
| 88 | paddingLeft: '0.5em', |
| 89 | }} |
| 90 | > |
| 91 | {i + 1} |
| 92 | </div> |
| 93 | <div style={{ display: 'table-cell', fontSize: '13px' }}> |
| 94 | {line.map((token, key) => ( |
| 95 | <span key={key} {...getTokenProps({ token, key })} /> |
| 96 | ))} |
| 97 | </div> |
| 98 | </div> |
nothing calls this directly
no outgoing calls
no test coverage detected