1b6f1f91 by Glitch (hello-express)

:woman::boot: Checkpoint

./server.js:13690106/1211
./package.json:13690106/1284
1 parent e78428c9
......@@ -10,7 +10,8 @@
"start": "node server.js"
},
"dependencies": {
"express": "^4.17.1"
"express": "^4.17.1",
"gun": "^0.2020.401"
},
"engines": {
"node": "12.x"
......
// server.js
// where your node app starts
// we've started you off with Express (https://expressjs.com/)
// but feel free to use whatever libraries or frameworks you'd like through `package.json`.
const express = require("express");
const app = express();
// our default array of dreams
const dreams = [
"Find and count some sheep",
"Climb a really tall mountain",
"Wash the dishes"
];
// make all the files in 'public' available
// https://expressjs.com/en/starter/static-files.html
app.use(express.static("public"));
// https://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
response.sendFile(__dirname + "/views/index.html");
});
// send the default array of dreams to the webpage
app.get("/dreams", (request, response) => {
// express helps us take JS objects and send them as JSON
response.json(dreams);
});
// listen for requests :)
const listener = app.listen(process.env.PORT, () => {
console.log("Your app is listening on port " + listener.address().port);
});
var Gun = require('gun');
var server = require('http').createServer().listen(3000);
var gun = Gun({web: server});
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!