This file contains hidden or 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
| //import express | |
| const express = require('express') | |
| //import ejs | |
| const ejs = require('ejs') | |
| //load express | |
| const app = express() | |
| //set port number | |
| const port = 5000 | |
| //tell express to use ejs as our template/view engine | |
| app.set('view engine', 'ejs') |
This file contains hidden or 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
| //listen on the port number | |
| app.listen( port, () => { | |
| console.log("App is live") | |
| }) |
This file contains hidden or 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
| //route to homepage | |
| app.get( '/', (req, res) => { | |
| //render the template for the homepage | |
| res.render('home'); | |
| }) |
This file contains hidden or 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
| <!Doctype html> | |
| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <header> | |
| </header> | |
| <main> | |
| <h1 style="text-align:center">Welcome</h1> | |
| </main> |
This file contains hidden or 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
| //tell express to use ejs as our template/view engine | |
| app.set('view engine', 'ejs') | |
| //tell express to use pages as our views directory | |
| app.set('views', './pages') |
This file contains hidden or 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
| //import express | |
| const express = require('express') | |
| //import ejs | |
| const ejs = require('ejs') | |
| //load express | |
| const app = express() | |
| //set port number | |
| const port = 5000 |
This file contains hidden or 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
| function unscramble(word) { | |
| //import dictionary | |
| const dict = require('an-array-of-english-words'); | |
| //return the result of our logic | |
| return( | |
| dict.filter( item => { | |
| //handle reoccurrences | |
| const reOccurrence1 = {} | |
| const reOccurrence2 = {} | |
| //check if their lengths are equal |
This file contains hidden or 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
| function unscramble(word) { | |
| //import dictionary | |
| const dict = require('an-array-of-english-words'); | |
| //return the result of our logic | |
| return( | |
| dict.filter( item => { | |
| //handle reoccurrences | |
| const reOccurrence1 = {} | |
| const reOccurrence2 = {} | |
| //check if their lengths are equal |
This file contains hidden or 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
| function unscramble(word) { | |
| //import dictionary | |
| const dict = require('an-array-of-english-words'); | |
| //return the result of our logic | |
| return( | |
| dict.filter( item => { | |
| //handle reoccurrences | |
| const reOccurrence1 = {} | |
| const reOccurrence2 = {} | |
| //check if their lengths are equal |
This file contains hidden or 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
| function unscramble(word) { | |
| //import dictionary | |
| const dict = require('an-array-of-english-words'); | |
| //return the result of our logic | |
| return( | |
| dict.filter( item => { | |
| //check if their lengths are equal | |
| if(item.length === word.length){ | |
| //logic continuation here | |
| } |