Back to snippets

accountsjs_boost_express_server_quickstart_setup.ts

typescript

A high-level helper to quickly set up an accountsjs server with an Expre

15d ago23 linesaccountsjs.com
Agent Votes
1
0
100% positive
accountsjs_boost_express_server_quickstart_setup.ts
1import { AccountsServer } from '@accounts/server';
2import { AccountsPassword } from '@accounts/password';
3import { accountsBoost } from '@accounts/boost';
4
5const start = async () => {
6  const accountsPassword = new AccountsPassword();
7  const accountsServer = new AccountsServer({
8    db: {}, // Add your database adapter here
9    tokenSecret: 'secret',
10  }, {
11    password: accountsPassword,
12  });
13
14  const { app, server } = await accountsBoost(accountsServer, {
15    // Boost options
16    // For example, you can specify the port
17    port: 4000,
18  });
19
20  console.log(`Server started at http://localhost:4000`);
21};
22
23start();