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

@typescript-auth/server

v2.0.7

Published

This is a simple standalone server.

Downloads

159

Readme

@typescript-auth/server ♟

npm version main codecov Known Vulnerabilities

This package contains a simple standalone server.


Important NOTE

The README.md is under construction ☂ at the moment. So please stay patient or contribute to it, till it covers all parts ⭐.


Table of Contents

Installation

npm install @typescript-auth/server --save

Usage

Config

In general no configuration file is required at all! All options have either default values or are generated automatically 🔥.

To overwrite the default (generated) config property values, create a server.config.js file in the root directory with the following content:

module.exports = {
    env: process.NODE_ENV, // development, production, test
    port: 3010,

    adminUsername: 'admin',
    adminPassword: 'start123',
    
    // robotSecret: '', // 
    
    root: process.cwd(),
    writableDirectory: 'writable',

    selfUrl: 'http://127.0.0.1:3010/',
    webUrl: 'http://127.0.0.1:3000/',

    tokenMaxAge: {
        accessToken: 3600, // 1 hour
        refreshToken: 36000 // 10 hours
    },
    
    swaggerDocumentation: true,
    
    redis: true,
}

Another way is e.g. to place an .env file in the root-directory or provide these properties by the system environment.

PORT=3010

ADMIN_USERNAME=admin
ADMIN_PASSWORD=start123

ROBOT_SECRET=xxx
PERMISSIONS=data_add,data_edit,...

SELF_URL=http://127.0.0.1:3010/
WEB_URL=http://127.0.0.1:3000/

WRITABLE_DIRECTORY=writable

REFRESH_TOKEN_MAX_AGE=3600
ACCESS_TOKEN_MAX_AGE=3600

SWAGGER_DOCUMENTATION=true

REDIS=true

Setup

If no option is specified, all options are by default true as long no other option is explicit specified. In the following shell snippet all options are manually set to true.

$ auth-server setup \
  --keyPair=true \
  --database=true \
  --databaseSeeder=true \
  --documentation=true

The output should be similar, with other values for the Robot ID and Robot Secret:

✔ Generated rsa key-pair.
✔ Created database.
✔ Synchronized database schema.
✔ Seeded database.
ℹ Robot ID: 51dc4d96-f122-47a8-92f4-f0643dae9be5
ℹ Robot Secret: d1l33354crj1kyo58dbpflned2ocnw2yez69

Start

To start the server simply execute the command:

$ auth-server start

It will output the following information on startup:

ℹ Environment: development
ℹ WritableDirectory: C:\Data\Projects\tada5hi\repositories\typescript-auth\packages\backend\server\writable
ℹ URL: http://127.0.0.1:3010/
ℹ Docs-URL: http://127.0.0.1:3010/docs
ℹ Web-URL: http://127.0.0.1:3000/
✔ Initialised controllers & middlewares.
✔ Established database connection.
✔ Built & started token aggregator.
✔ Startup completed.

Upgrade

To upgrade the server (migrations, schemes, ...), run:

$ auth-server upgrade