Skip to content

Commit

Permalink
Merge pull request #4 from JooLuiz/fix/adjusting-file-reader
Browse files Browse the repository at this point in the history
[fix] - Adjusting loadFile and serverStaticDirectoriesto read from project base directory not from inside node_modules
  • Loading branch information
JooLuiz authored Jul 6, 2024
2 parents 67e3717 + c75111b commit cd233b6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 427 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - yyyy-mm-dd

## [0.2.1] - 2024-07-06

### Fixed

- Adjusting loadFile and serverStaticDirectoriesto read from project base directory not from inside node_modules

## [0.2.0] - 2024-07-06

### Added
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ You can configure Simpler to serve static files from a directory using the `addS
import path from "path";
import { readFile } from "fs";

simpler.router.addStaticDirectory("static");
simpler.router.addStaticDirectory("./src/static");

simpler.router.addRoute("/static", ["GET"], (_req, res) => {
const testePath = path.join(__dirname, "static", "test.html");
Expand All @@ -127,7 +127,7 @@ Below you'll find an example of how to use it.

```typescript
simpler.router.addRoute("/static-page", ["GET"], (_req, res) => {
simpler.loadFile(res, "./static/teste.html");
simpler.loadFile(res, "./src/static/teste.html");
});
```

Expand Down Expand Up @@ -191,10 +191,10 @@ simpler.router.addRoute(
}
);

simpler.router.addStaticDirectory("static");
simpler.router.addStaticDirectory("./src/static");

simpler.router.addRoute("/static-page", ["GET"], (_req, res) => {
simpler.loadFile(res, "./static/teste.html");
simpler.loadFile(res, "./src/static/teste.html");
});

simpler.errorHandler.setCustomErrorHandler(
Expand Down
8 changes: 4 additions & 4 deletions README.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Você pode configurar o Simpler para servir arquivos estáticos de um diretório
import path from "path";
import { readFile } from "fs";

simpler.router.addStaticDirectory("static");
simpler.router.addStaticDirectory("./src/static");

simpler.router.addRoute("/static", ["GET"], (_req, res) => {
const testePath = path.join(__dirname, "static", "test.html");
Expand All @@ -127,7 +127,7 @@ Abaixo você encontrará um exemplo de como utilizar-la.

```typescript
simpler.router.addRoute("/static-page", ["GET"], (_req, res) => {
simpler.loadFile(res, "./static/teste.html");
simpler.loadFile(res, "./src/static/teste.html");
});
```

Expand Down Expand Up @@ -192,10 +192,10 @@ simpler.router.addRoute(
}
);

simpler.router.addStaticDirectory("static");
simpler.router.addStaticDirectory("./src/static");

simpler.router.addRoute("/static-page", ["GET"], (_req, res) => {
simpler.loadFile(res, "./static/teste.html");
simpler.loadFile(res, "./src/static/teste.html");
});

simpler.errorHandler.setCustomErrorHandler(
Expand Down
Loading

0 comments on commit cd233b6

Please sign in to comment.