Started express project
This commit is contained in:
parent
f4b48aa729
commit
613defa81b
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Don't copy NPM modules around!
|
||||
node_modules/
|
||||
|
||||
# Don't commit compiled CSS files
|
||||
public/stylesheets/*.css
|
32
index.js
Normal file
32
index.js
Normal file
@ -0,0 +1,32 @@
|
||||
const express = require('express');
|
||||
const sassMiddleware = require('node-sass-middleware');
|
||||
const path = require('path');
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
// configure the Pug templating engine
|
||||
app.set('views', './views');
|
||||
app.set('view engine', 'pug');
|
||||
|
||||
// initialize SASS compiler middleware
|
||||
app.use(sassMiddleware({
|
||||
src: path.join(__dirname, 'public', 'stylesheets'),
|
||||
dest: path.join(__dirname, 'public', 'stylesheets'),
|
||||
indentedSyntax: true,
|
||||
outputStyle: 'compressed',
|
||||
prefix: '/static/stylesheets',
|
||||
debug: true
|
||||
}));
|
||||
|
||||
// serve static files
|
||||
app.use('/static', express.static(path.join(__dirname, 'public')));
|
||||
|
||||
// Index GET route
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index');
|
||||
});
|
||||
|
||||
// start Express app
|
||||
app.listen(port, () => {
|
||||
console.log(`The Bit Goblin website is listening on port ${port}`);
|
||||
});
|
5674
package-lock.json
generated
Normal file
5674
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
package.json
Normal file
20
package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "bitgoblin-website",
|
||||
"version": "0.1.0",
|
||||
"description": "The Bit Goblin official website",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "gitea@git.metaunix.net:bitgoblin/website.git"
|
||||
},
|
||||
"author": "Gregory Ballantine <gballantine@bitgoblin.tech>",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"express": "^4.17.3",
|
||||
"node-sass-middleware": "^1.0.1",
|
||||
"pug": "^3.0.2"
|
||||
}
|
||||
}
|
2
public/stylesheets/zulrah.sass
Normal file
2
public/stylesheets/zulrah.sass
Normal file
@ -0,0 +1,2 @@
|
||||
body
|
||||
background: grey
|
8
views/index.pug
Normal file
8
views/index.pug
Normal file
@ -0,0 +1,8 @@
|
||||
doctype=html
|
||||
html
|
||||
head
|
||||
title Bit Goblin
|
||||
link(rel='stylesheet', href='/static/stylesheets/zulrah.css')
|
||||
body
|
||||
h1 Bit Goblin
|
||||
p This is a test!
|
Loading…
Reference in New Issue
Block a user