Skip to content

Commit

Permalink
added homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-vaibhav committed Oct 15, 2023
1 parent 7bc9b6d commit dfde752
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "trybackroad",
"version": "1.0.0",
"type": "module",
"description": "",
"main": "src/main.js",
"scripts": {
"dev": "tsx watch ./src/main.ts",
"build": "tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@backroad/backroad": "*"
},
"devDependencies": {
"tsx": "^3.13.0",
"typescript": "^5.2.2"
}
}
68 changes: 68 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { run } from "@backroad/backroad";
run(async (br) => {
const repoData = br.getOrDefault(
"repo-data",
null as null | { stars: number; latestVersion: string }
);
br.write({
body: `# 🛣️ Welcome to Backroad
This is a quick start template to help you get started developing backroad apps. You can also checkout the examples on [stackblitz](https://stackblitz.com/@sudo-vaibhav/collections/backroad)`,
});
br.linkGroup({
items: [
{
label: "Read the Docs",
href: "https://backroad.sudomakes.art/docs/fundamentals/introduction/",
target: "_blank",
},
{
label: "Learn Backroad in 3 minutes",
href: "https://backroad.sudomakes.art/docs/fundamentals/introduction/",
target: "_blank",
},
{
label: "Backroad Github",
href: "https://github.com/sudomakes/backroad",
target: "_blank",
},
{
label: "Backroad Website",
href: "https://backroad.sudomakes.art",
target: "_blank",
},
{
label: "Examples on Stackblitz",
href: "https://stackblitz.com/@sudo-vaibhav/collections/backroad",
target: "_blank",
},
],
});
br.write({
body: `Backroad presents an unconventional way of **making UI with Node.JS with very minimal code**. In the complexity-ridden world of web technology, **Backroad aims to offer a simpler alternative, a road less travelled**
---
Backroad is currently in beta-development phase. If you like the idea behind it and would like to see it develop further. Please [consider starring Backroad on Github](https://github.com/sudomakes/backroad), or tell your developer friends about it. Thanks for trying backroad 💖`,
});
if (repoData === null) {
const [repo, tags] = await Promise.all(
(
await Promise.all([
fetch("https://api.github.com/repos/sudomakes/backroad"),
fetch("https://api.github.com/repos/sudomakes/backroad/tags"),
])
).map((resp) => resp.json())
);

br.setValue("repo-data", {
stars: repo.stargazers_count,
latestVersion: tags[0].name,
});
} else {
br.stats({
items: [
{ label: "Backroad Stars", value: repoData.stars },
{ label: "Latest Version", value: repoData.latestVersion },
],
});
}
});
11 changes: 11 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"moduleResolution": "node",
"outDir": "./dist",
"target": "ESNext",
"module": "ESNext",
"noEmitOnError": true
},
"include": ["**/*.ts"],
"exclude": ["node_modules"]
}

0 comments on commit dfde752

Please sign in to comment.