Adding beginning code.

This commit is contained in:
Bradley 2021-03-02 10:40:18 -08:00
parent ae11910034
commit 4c560ffea1
5 changed files with 1348 additions and 0 deletions

1288
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

16
package.json Normal file
View file

@ -0,0 +1,16 @@
{
"name": "node-auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Bradley Shellnut",
"license": "ISC",
"dependencies": {
"fastify": "^3.12.0",
"fastify-static": "^4.0.1"
}
}

1
src/db.js Normal file
View file

@ -0,0 +1 @@
console.log('Hello from the db');

31
src/index.js Normal file
View file

@ -0,0 +1,31 @@
import { fastify } from 'fastify'
import fastifyStatic from 'fastify-static'
import path from 'path'
import { fileURLToPath } from 'url'
// ESM specific "features"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const app = fastify()
async function startApp() {
try {
app.register(fastifyStatic, {
root: path.join(__dirname, "public"),
})
// app.get("/", {}, (request, reply) => {
// reply.send({
// data: "hello world",
// })
// })
await app.listen(3000);
console.log('Server Listening at port: 3000');
} catch (e) {
console.log(e);
}
}
startApp()

12
src/public/index.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>