Webserver made for TypeScript, using TypeScript.
🔥 Dynamic paths
🐶 Pug SSR support
👏 Split classes in files for easier maintainability
// index.ts
import { PapayaServer } from "papaya.js";
const server = new PapayaServer();
// Middleware
server.use(function testWare(req, res) {
return new Promise((resolve, reject) => {
resolve("TestData")
})
})
server.listen();
// ./server/get/index.ts
import { renderPublic, PapayaRoute } from "papaya.j"
export default class GetIndex extends PapayaRoute {
path = "/";
callback = () => {
return new Promise((resolve) => {
resolve(renderPublic("index.html"));
})
};
}
- Full Bun support
- Made using standard Node.js libraries, purposed to be used with Bun
- Asynchronous and promised
- Middleware and routes are made using promises, ensuring a blazingly fast server.
- Public files are served asynchronously alongside coded paths.
- Easy filesystem layout instead of spaghetti-code files.
To initiate a new project, make a new directory:
$ mkdir papaya-project
$ cd papaya-project
Set-up a new project using NPM:
$ npm create papaya@latest
Run your brand new project:
$ bun index.ts
Due to the nature of the framework, you can exclusively use Bun for now.
- 📁 server
- 📁 get - GET endpoint controller files.
- 🗒️main.ts - example GET controller.
- 📁 post - POST endpoint controller files.
- 🗒️hello.ts - example POST controller
- 📁 public - Public files.
- 🗒️moveButton.js - example served file.
- 🗒️adminPage.html - example served file.
- 📁 get - GET endpoint controller files.
- 🗒️entry.ts - Entry point for server