-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add EvoluServer, refactor out Express
Now, it's possible to make Hono and other adapters easily.
- Loading branch information
Showing
8 changed files
with
238 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@evolu/server": minor | ||
--- | ||
|
||
Add EvoluServer, refactor out Express | ||
|
||
Now, it's possible to make Hono and other adapters easily. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { createExpressApp } from "@evolu/server"; | ||
import { Effect } from "effect"; | ||
|
||
const app = createExpressApp(); | ||
Effect.runPromise(createExpressApp).then((app) => { | ||
// eslint-disable-next-line turbo/no-undeclared-env-vars | ||
const port = process.env.PORT || 4000; | ||
|
||
// eslint-disable-next-line turbo/no-undeclared-env-vars | ||
const port = process.env.PORT || 4000; | ||
|
||
app.listen(port, () => { | ||
// eslint-disable-next-line no-console | ||
console.log(`Server is listening at http://localhost:${port}`); | ||
app.listen(port, () => { | ||
// eslint-disable-next-line no-console | ||
console.log(`Server is listening at http://localhost:${port}`); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { MerkleTreeString, OwnerId, TimestampString } from "@evolu/common"; | ||
import { Context } from "effect"; | ||
import { Kysely } from "kysely"; | ||
|
||
/** Evolu Server database schema. */ | ||
export interface Database { | ||
readonly message: MessageTable; | ||
readonly merkleTree: MerkleTreeTable; | ||
} | ||
|
||
interface MessageTable { | ||
readonly timestamp: TimestampString; | ||
readonly userId: OwnerId; | ||
readonly content: Uint8Array; | ||
} | ||
|
||
interface MerkleTreeTable { | ||
readonly userId: OwnerId; | ||
readonly merkleTree: MerkleTreeString; | ||
} | ||
|
||
/** | ||
* Evolu Server Kysely instance. Use only PostgreSQL or SQLite dialects for now. | ||
* https://kysely-org.github.io/kysely-apidoc/classes/InsertQueryBuilder.html#onConflict | ||
*/ | ||
export type Db = Kysely<Database>; | ||
export const Db = Context.Tag<Db>(); | ||
|
||
export interface BadRequestError { | ||
readonly _tag: "BadRequestError"; | ||
readonly error: unknown; | ||
} |
Oops, something went wrong.
e401e55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
evolu – ./
evolu.vercel.app
evolu-evolu.vercel.app
evolu-git-main-evolu.vercel.app
www.evolu.dev
evolu.dev