Skip to content

Commit ba1e932

Browse files
committed
updated docs
1 parent a2f5906 commit ba1e932

File tree

5 files changed

+99
-11
lines changed

5 files changed

+99
-11
lines changed

docs/docs/getting-started/quickstart.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ sidebar_position: 1
44

55
# quickstart
66

7-
## using node.js
7+
## initialization
8+
9+
### with node.js
810

911
```sh
1012
# create a new directory for your project
@@ -24,7 +26,7 @@ npm start
2426

2527
initializing will create the exa.js template project structure in the current directory.
2628

27-
## using bun
29+
### with bun
2830

2931
```bash
3032
# create a new directory for your project
@@ -43,3 +45,24 @@ bun run start
4345
```
4446

4547
initializing will create the exa.js template project structure in the current directory.
48+
49+
## usage
50+
51+
after starting, your terminal should show some startup information such as:
52+
53+
```bash
54+
exa.js by tux - v0.0.17
55+
-----------------------------
56+
2024-12-23T23:09:26.400-06:00
57+
-----------------------------
58+
mode: development
59+
server running on 0.0.0.0:8118
60+
```
61+
62+
depending on which modules are enabled, there may be some additional output.
63+
64+
the seed project created after initialization has an api route `/api/hello/world` created. to see its output, run
65+
66+
```bash
67+
curl http://127.0.0.1:8118/api/hello/world
68+
```

docs/docs/intro.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
---
22
sidebar_position: 1
3+
sidebar_label: introduction
34
---
45

5-
# welcome
6-
7-
## what is exa.js?
6+
# exa.js
87

98
exa.js is a minimal node.js backend framework that has a strong focus on simplicity, modularity, and convention over configuration. it makes available the most important stuff needed for a node.js web framework, and nothing more.
109

11-
## motivation
10+
## javascript's 10,000th framework
1211

1312
as if the javascript ecosystem needs another framework... i get it, but please know that this project is the culmination of ~10 years of professional development trying to understand what i/people really need in a framework. this project is the consolidated and cleaned up version of about 30 projects worth of boilerplate patchwork that has been unevenly iterated on and used in some form during this time. i'm certain you'll find use for it, and i certainly will.
13+
14+
## requirements
15+
16+
- node.js v10+
17+
- optional: bun
18+
- optional: docker
19+
20+
## get going in the next two minutes
21+
22+
```bash
23+
# create a new directory for your project
24+
mkdir myproject; cd myproject
25+
26+
# initialize
27+
npx @exajs/core init
28+
29+
# start dev with auto reload
30+
npm run watch
31+
32+
# test
33+
curl http://127.0.0.1:8118/api/hello/world
34+
```
35+
36+
## contributing
37+
38+
this project needs testing and bug fixes more than anything else. it also needs expansion of the core library of helper code.

docs/docs/modules/migrations.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_position: 10
3+
---
4+
5+
# migrations
6+
7+
the purpose of migrations is to easily apply and rollback changes to a database in a way that will sync across workspaces and developers. although not technically a module since `exa.js` has no internal code associated with migrations, it's included as a recommended way of handling database migrations anyway. the `migrations` directory could also be used with other tools, if so desired.
8+
9+
## jmig
10+
11+
the suggested migration tool and the one this documentation will focus on is `jmig`. the full documentation for this tool is located at [https://github.com/realtux/jmig](https://github.com/realtux/jmig). `jmig` is invoked in an `exa.js` project via `npx`.
12+
13+
## managing migrations
14+
15+
migration files are created in the `migrations` folder using the jmig command `npx jmig create <migration name>`. to create a migration file like the one in the next section, you could run `npx jmig create initial tables`. after the migration file is filled out, the changes can be applied with `npx jmig migrate`. changes can be rolled back with `npx jmig rollback`.
16+
17+
## sample migration file
18+
19+
```sql title="migrations/20240417195942-initial-tables.sql"
20+
up:
21+
create table users (
22+
user_id int unsigned primary key auto_increment,
23+
name varchar(64) not null,
24+
email varchar(64) not null,
25+
created_at datetime not null
26+
) character set utf8mb4 collate utf8mb4_unicode_ci;
27+
28+
down:
29+
drop table users;
30+
```
31+
32+
### how to interpret
33+
34+
a blank migration file will have only `up:` and `down:` in it to start. changes to a database should be placed under the `up:` section, then reversing those changes should be placed in the `down:`. in the provided example, a `users` table is created upon migration, and then dropped upon rollback.

docs/docusaurus.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const config = {
4848
// Please change this to your repo.
4949
// Remove this to remove the "edit this page" links.
5050
editUrl:
51-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
51+
'https://github.com/realtux/exa/tree/master/docs',
5252
},
5353
blog: {
5454
showReadingTime: true,
@@ -59,7 +59,7 @@ const config = {
5959
// Please change this to your repo.
6060
// Remove this to remove the "edit this page" links.
6161
editUrl:
62-
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
62+
'https://github.com/realtux/exa/tree/master/docs',
6363
// Useful options to enforce blogging best practices
6464
onInlineTags: 'warn',
6565
onInlineAuthors: 'warn',
@@ -92,7 +92,7 @@ const config = {
9292
navbar: {
9393
title: 'exa.js',
9494
logo: {
95-
alt: 'My Site Logo',
95+
alt: 'exa.js',
9696
src: 'img/logo.svg',
9797
},
9898
items: [
@@ -104,7 +104,7 @@ const config = {
104104
},
105105
{
106106
href: 'https://github.com/realtux/exa',
107-
label: 'GitHub',
107+
label: 'github',
108108
position: 'right',
109109
},
110110
],
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
up:
2-
2+
create table users (
3+
user_id int unsigned primary key auto_increment,
4+
name varchar(64) not null,
5+
email varchar(64) not null,
6+
created_at datetime not null
7+
) character set utf8mb4 collate utf8mb4_unicode_ci;
38

49
down:
10+
drop table users;

0 commit comments

Comments
 (0)