1.0.2 • Published 10 months ago

@storecraft/platforms v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Storecraft Node.js Platform support

So, if you wanted to run StoreCraft on the following platforms,

  • Node.js
  • Deno
  • Bun
  • Cloudflare Workers
  • Google Functions
  • Azure Functions
  • AWS Lambda Functions (with API Gateway)
  • Vercel Platform

What does it do exactly ?

Basically,

  • Translates incoming messages into web Request
  • Translates outgoing messages into web Response
  • Exposes environmant variables
  • Adds helpers
npm i @storecraft/platforms

usage

import 'dotenv/config';
import http from "node:http";
import { join } from "node:path";
import { homedir } from "node:os";

import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/platforms/node'
import { MongoDB } from '@storecraft/database-mongodb-node'
import { NodeLocalStorage } from '@storecraft/storage-local/node'

const app = new App(
    config
  )
  .withPlatform(new NodePlatform())
  .withDatabase(new MongoDB())
  .withStorage(new NodeLocalStorage(join(homedir(), 'tomer')))

await app.init();
 
const server = http.createServer(app.handler).listen(
  8000,
  () => {
    console.log(`Server is running on http://localhost:8000`);
  }
); 
Author: Tomer Shalev (tomer.shalev@gmail.com)
1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago