0.3.24 • Published 7 months ago

@stanlemon/server-with-auth v0.3.24

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Express App Server with Authentication

npm version

This is a base express app server that is wired up with sensible defaults, like compression, json support and serving the dist folder statically and also includes basic authentication support. It builds off of the @stanlemon/server package.

This package includes authentication against secure endpoints using JWT. There are endpoints for logging in and signing up, as well as basic user management flows such as updating a profile, verifying a user and resetting a password.

When NODE_ENV=development the server will also proxy requests to webpack.

This library goes well with @stanlemon/webdev. You can see this package, along with @stanlemon/webdev in action by using the @stanlemon/app-template package.

import {
  createAppServer,
  asyncJsonHandler as handler,
  NotFoundException,
  LowDBUserDao,
  createLowDb
} from "@stanlemon/server-with-auth";
import  from "./src/data/lowdb-user-dao.js";

const db = createLowDb();
const dao = new LowDBUserDao(db);

const app = createAppServer({
  port: 3003,secure: ["/api/"],
  schemas,
  dao,
 });


// Insecure endpoint
app.get(
  "/",
  handler(() => ({ hello: "world" }))
);

// Secure endpoint
app.get(
  "/api/users",
  handler(() => ({
    users: db.data.users.map((u) =>
      omit(u, ["password", "verification_token"])
    ),
  }))
);
0.3.24

7 months ago

0.3.23

7 months ago

0.3.22

7 months ago

0.3.21

8 months ago

0.3.20

8 months ago

0.3.19

9 months ago

0.3.18

9 months ago

0.3.17

9 months ago

0.3.16

10 months ago

0.3.15

11 months ago

0.3.14

11 months ago

0.3.13

12 months ago

0.3.12

12 months ago

0.3.11

1 year ago

0.3.10

1 year ago

0.3.9

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.1.30

2 years ago

0.1.27

2 years ago

0.1.28

2 years ago

0.1.29

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.25

2 years ago

0.1.26

2 years ago

0.1.24

2 years ago

0.1.21

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.1.20

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.17

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.14

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago