JSPM

  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q52211F
  • License ISC

All in one server...

Package Exports

  • @shinerzoch/server
  • @shinerzoch/server/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shinerzoch/server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Getting Started

To get started please run the following commands from your project directory. If you havent done so yet please make sure you have NodeJS installed. Please make sure you init your project by using the command below.

npm init --yes

Now in order to get started using our package as your server. Please run the following command.

npm i @shinerzoch/server

This command will install our package inside your application. This will allow you to use the below coding to get started.

Javascript NodeJS Module

// index.mjs

import Server from '../serverLibrary/index.js';
const port = 8080;

    // App logic goes here...    

Server.start(port);

Javascript NodeJS

// index.js

const Server = require('../serverLibrary/index.js');

(async () => {
    const port = 8080;
    
        // App logic goes here...   

    Server.start(port);
})();

Table Of Contents

Database Module

AutoRoutes Module

AuthSystem Module

Cookies Module

Session Module

Server Side Events Module

WebSocket Module

Database Module

Create Mysql Instance | Create Local Instance | Find One Data - Example | Find Data - Example | Save Data - Example | Update Data - Example | Delete Data - Example

You can set the default database by setting Server.db = DatabaseInstance. This is not a requirement, but it is recommended if you plan on using the database as your main projects database.

Create Mysql Database Instance ## {#database-mysql-create}

const db = await Server.Database.create("mysql", {
    modelsPath: "models",
    name: "default",
    host: "localhost",
    port: 3306,
    username: "testing",
    password: "testing",
    database: "testing",
});

Create Local Database Instance

This is a database that is completely file based and the contents are stored within your project. or any directory of choosing.

const db = await Server.Database.create("local", {
    name: "default", // Must be unqiue if not default.
    modelsPath: "models"
});