1.0.4 • Published 1 year ago

cappaccino v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Cappaccino is a work in progress.

The framework is built on top of ExpressJS.

Current features:

  • Supports native express functionality
  • Mongoose is built in, and requires a single function call to connect a database
  • Built in JWT support
  • Built in single file upload routes
  • AWS Mock S3 (w.i.p)
  • Unhandled route rejection built in
  • Local file system api

Coming soon:

  • Built in support for MySQL databases
  • Payload validation
  • Built in Email system

Example server setup

const Cappaccino = require("Cappaccino");
const path = require('path');
const router = require("./routes/router");

// Make a new app
const app = Cappaccino.newApp({ 
  port: 4000, 
  useEnv: true,
  envPath: path.join(__dirname, ".env"),
  rejectUnhandled: true,
  useJson: true,
  useCors: true,
  handleValidationErrors: true
})

// Connect to a database
app.useDatabase({
  type:'mongo', 
  uri: process.env.MONGO_URI,
  gracefulShutdown: true
});

app.getRoute("/myroute", function(request, response) {
  response.send('hi')
})

// Add subroutes
app.subRoute('/routes', router);

// Start the app
app.start().then(server => {
  console.log('Server started successfully');
}).catch(err => {
  console.error('Error starting server:', err);
});