@synthql/handler-express
TypeScript icon, indicating that this package has built-in type declarations

0.109.4 • Public • Published

@synthql/handler-express

SynthQL-compatible route handler function for use in Express.js server app.

// src/queryEngine.ts
import { QueryEngine } from '@synthql/backend';

export const queryEngine = new QueryEngine({
    url: 'postgresql://user:password@localhost:5432/dbname',
});

// src/index.ts
import express from 'express';
import { createExpressSynthqlHandler } from '@synthql/handler-express';
import { queryEngine } from './queryEngine';

const app = express();
const expressSynthqlRequestHandler = createExpressSynthqlHandler(queryEngine);

app.post('/synthql', async (req, res) => {
    return await expressSynthqlRequestHandler(req, res);
});

app.listen(3000);

Links

Readme

Keywords

none

Package Sidebar

Install

npm i @synthql/handler-express

Weekly Downloads

408

Version

0.109.4

License

MIT

Unpacked Size

175 kB

Total Files

19

Last publish

Collaborators

  • fernandohur