0.0.14-alpha.0 • Published 11 months ago

@vsmi/sinx v0.0.14-alpha.0

Weekly downloads
-
License
-
Repository
-
Last release
11 months ago

@vsmi/sinx

a simple http server library

npm deps license build prs

GET STARTED

import sinx from '@vsmi/sinx';
import path from 'path';

const PORT = 9071;
sinx
    .server({
        port: PORT,
    })
    .addRouter(
        sinx
            .router()
            .all('/favicon.ico', (context) => {
                context.cache().setContentType('image/x-icon').emitFile(path.resolve(__dirname, './public/favicon.ico'));
            })
            .all('/', (ctx) => {
                return 'Hello Sinx!';
            })
    )
    .start(() => {
        console.log(`Server is running at http://localhost:${PORT}/`);
    });

LICENSE

MIT