Miss any of our Open RFC calls?Watch the recordings here! »

@suddenly/server

1.4.0 • Public • Published

@suddenly/server

Some handy helpers for Express apps.

Usage

Create a server with bodyParser, CORS, Helmet, and EJS views already applied.

Create a router with subrouters and an error handler already set up.

import { createServer, createRoutes } from '@suddenly/server';
 
const server = createServer({ views: 'src/server/views' });
server.use(
  createRouter(
    {
      '/api': {
        '/users': Users,
        '/things': Things
      },
      '/': Root
    } /* , override the error handler by passing a function here */
  )
);
 
server.listen(5000, () => {
  console.log('Listening at http://localhost:5000');
});

Contributors

Keywords

Install

npm i @suddenly/server

DownloadsWeekly Downloads

21

Version

1.4.0

License

ISC

Unpacked Size

9.77 kB

Total Files

4

Last publish

Collaborators

  • avatar