import cors from "@fastify/cors";
This commit is contained in:
parent
fa975b9743
commit
10d1e0dd4d
3 changed files with 33 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import path from "node:path";
|
||||
import cors from "@fastify/cors";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { estaticos } from "../src";
|
||||
import { ambiente } from "./ambiente";
|
||||
|
|
@ -56,10 +57,14 @@ const criarHtml = (entrada: {
|
|||
gerar.then(() => {
|
||||
const fastify = Fastify({
|
||||
logger: true,
|
||||
|
||||
ignoreTrailingSlash: true,
|
||||
});
|
||||
|
||||
//cors
|
||||
fastify.register(cors, {
|
||||
origin: "*",
|
||||
});
|
||||
|
||||
fastify.route({
|
||||
method: "GET",
|
||||
url: "/",
|
||||
|
|
@ -116,6 +121,8 @@ gerar.then(() => {
|
|||
|
||||
fastify.listen({ port: Number(PORTA) }, (err, address) => {
|
||||
if (err) throw err;
|
||||
console.log(`${new Date().toISOString()} Servidor ${PREFIXO} Rodando em ${address}`);
|
||||
console.log(
|
||||
`${new Date().toISOString()} Servidor ${PREFIXO} Rodando em ${address}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue