-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad4458f
commit 26bf530
Showing
29 changed files
with
2,173 additions
and
1 deletion.
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
.env | ||
.firebase | ||
node_modules |
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,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Wordle" | ||
] | ||
} |
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,2 @@ | ||
# word-gotchu | ||
Pixel styled web platform game based on Wordle and original characters known as “Gotchus’’ that battle against each other in an arena. |
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,37 @@ | ||
const express = require("express"); | ||
const bodyParser = require("body-parser"); | ||
const cookieSession = require("cookie-session"); | ||
|
||
const router = require("./routes/router"); | ||
const apiRouter = require("./routes/api") | ||
|
||
const app = express(); | ||
|
||
app.set("view engine", "ejs") | ||
app.use(bodyParser.urlencoded({ extended: false })); | ||
app.use(bodyParser.json()) | ||
app.use(cookieSession({ | ||
name: 'player', | ||
keys: ['cookieMonsterProtection1', 'cookieMonsterProtection2'] | ||
})); | ||
app.use(express.static("public")); | ||
|
||
app.use("/", router); | ||
app.use("/api/v1", apiRouter) | ||
|
||
// Error Handling | ||
app.use((req, res, next) => { | ||
const error = new Error(`Not Found - ${req.originalUrl}`); | ||
res.status(404); | ||
next(error); | ||
}); | ||
|
||
app.use((err, req, res, next) => { | ||
const statusCode = res.statusCode === 200 ? 500 : res.statusCode; | ||
res.status(statusCode); | ||
res.json({ | ||
message: err.message | ||
}) | ||
}) | ||
|
||
module.exports = app; |
Oops, something went wrong.