Getting Started
Creating a ExposerJS Application
Installation
sh
$ npm install exposerjs
sh
$ pnpm install exposerjs
sh
$ yarn install exposerjs
sh
$ bun install exposerjs
Prerequisites
TIP
ExposerJS requires a version equal to or greater than 18 of Node.js and 5.5.o or greater of Prisma. You can try with older versions of both but we cannot ensure stability
Prisma
ExposerJS only need prisma instance to access the database.
Create index file
Create file index.js add the code to start the project:
js
import { exposer } from "exposerjs";
import { PrismaClient } from "@prisma/client";
exposer.run({PrismaClient});
js
import { exposer } from "exposerjs";
import { PrismaClient } from "@prisma/client";
//Express
import express from "express";
const app = express();
const port = process.env.PORT || 3000;
exposer.run({PrismaClient, app}); // app → express
app.listen(port, () => {
console.log(`Backend is ready ${port}`);
});
Run in console:
sh
node index.js
Output expected:
sh
ExposerJS deployed in XXms