@readytogo/server
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

readytogo-server

Create a pre-configured express HTTP server

Usage

import { newServer } from '@readytogo/server';

const { app, server } = newServer(9000, {});

app.get('/', (_req, res) => {
	res.send('Hello World!');
});

if (false) server.close();

Note

Every call to newServer() will try to create a new server instance and listen on the given port. Subsequent calls given the same port will throw EADDRINUSE error. If you want to create multiple servers, you should use different ports. Passing an empty object {} as the config parameter to newServer() will use the default configuration. It will enable all the middleware using the default values. If you want to disable specific middleware or change the default values, you should pass the proper configuration object.

/@readytogo/server/

    Package Sidebar

    Install

    npm i @readytogo/server

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    9.95 kB

    Total Files

    10

    Last publish

    Collaborators

    • yash-patel