npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kuaralabs-afterworkjs

v2.0.2

Published

afterworkjs is the library that even his mother didn't love him correctly

Downloads

1,357

Readme

Afterwork.js

Afterwork.js: Backend framework that isn't loved properly by even his mother. 🚬🥃

Afterworkjs Logo

Overview

Welcome to Afterwork.js – a backend framework that's as lightweight, fast, and atomic as they come. Designed with simplicity in mind, Afterwork.js provides the essentials you need to build efficient and effective server-side applications without the bloat.

Features

  • Lightweight: Minimal overhead ensures your applications run fast and efficiently.
  • Fast: Optimized for speed, Afterwork.js delivers high performance with minimal resources.
  • Atomic: Focuses on core functionalities to keep things simple and manageable.

Getting Started

To get started with Afterwork.js, follow these simple steps:

  1. Install Afterwork.js

    npm install kuaralabs-afterworkjs
  2. Create Your Server

    Create a file named server.js:

    import { AfterworkJS } from 'afterworkjs';
    
    // you can use dotenv
    const SECRET_KEY = 'your_secret_key';  // Replace with your actual secret key
    const DB_URL = 'your_database_url';    // Replace with your actual database URL
    const DB_NAME = 'your_database_name';  // Replace with your actual database name
       
    const app = new AfterworkJS({
      secret: SECRET_KEY,
      dbType: "postgres",                  // Replace with the databases that is supported
      dbConfig: {
        dbUrl: DB_URL,
        dbName: DB_NAME
      }
    });
    
    app.addRoute('get', '/hello', (req, res, next) => {
      res.json({ message: 'Hello, world!' });
    });
    
    app.start(3000);
  3. Run Your Server

    npm start

    Your server will be running on port 3000.

Features

  • Simple Routing: Define routes with ease using addRoute.
  • Middleware Support: Easily add middleware for request processing.
  • Database Integration: Supports MongoDB, PostgreSQL, and MySQL out of the box.
  • JWT Authentication: Secure your routes with JSON Web Tokens.

Example Usages

Here's a simple example of how to use Afterwork.js for routing and middleware:

import { AfterworkJS } from 'afterworkjs';

// you can use dotenv
const SECRET_KEY = 'your_secret_key';  // Replace with your actual secret key
const DB_URL = 'your_database_url';    // Replace with your actual database URL
const DB_NAME = 'your_database_name';  // Replace with your actual database name

const app = new AfterworkJS({
  secret: SECRET_KEY,
  dbType: "postgres",                  // Replace with the databases that is supported
  dbConfig: {
    dbUrl: DB_URL,
    dbName: DB_NAME
  }
});

// Middleware to log requests
app.use((req, res, next) => {
  console.log(`${req.method} ${req.url}`);
  next();
});

// Route to handle GET requests
app.addRoute('get', '/users', async (req, res) => {
  const users = await req.db.find('users', {});
  res.json(users);
});

// Start the server
app.start(3000);

and you can try wildcard

import { AfterworkJS } from 'afterworkjs';

// you can use dotenv
const SECRET_KEY = 'your_secret_key';  // Replace with your actual secret key
const DB_URL = 'your_database_url';    // Replace with your actual database URL
const DB_NAME = 'your_database_name';  // Replace with your actual database name

const app = new AfterworkJS({ 
  secret: SECRET_KEY, 
  dbType: 'mongo', 
  dbConfig: {
    dbUrl: DB_URL,
    dbName: DB_NAME
  } 
  });

app.addRoute('get', '/api/users/:id', (req, res) => {
  res.json({ userId: req.params.id });
});

app.addRoute('get', '/api/*', (req, res) => {
  res.json({ message: 'Wildcard route' });
});

app.start(3000);

Documentation

For detailed documentation on Afterwork.js, visit the official documentation.

Contributing

Contributions are welcome! Please submit issues, feature requests, and pull requests to the GitHub repository.

License

Afterwork.js is licensed under the MIT License.

Disclaimer

Afterwork.js: It might not be loved by everyone, but it gets the job done 🚬


feel free to contact us with [email protected] or with please "afterworkjs" title at [email protected]