Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    .tox-notification {
      display: none !important
    }
  </style>
  <script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
  <script type="text/javascript">
    tinymce.init({
      selector: "textarea",
      plugins: [
        "lists checklist link image print preview",
        "code fullscreen",
        "insertdatetime media paste save"
      ],
      toolbar: "save | preview | insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | checklist",
      //save_onsavecallback: function () { window.alert("Editor Content Saved"); }
    });
  </script>

</head>

<body>

  <form method="POST" action="/">
    <textarea name="content"></textarea>
  </form>
              
            
!

CSS

              
                
              
            
!

JS

              
                const http = require("http");
const fs = require("fs").promises;
const qs = require("querystring");

const HOST = "localhost";
const PORT = 8000;
const SERVE_URL = `http://${HOST}:${PORT}`;

const requestListener = function (req, res) {
  /* an express feature */
  if (req.method === "POST") {
    if (req.url === "/") {
      /* should this be just the / for the directory? */
      const chunks = []; /* turn the chunks variable into an empty array */

      req
        .on("data", (data) =>
          chunks.push(data)
        ) /* append data to the chunks variable */
        .on("end", () => {
          const buf = Buffer.concat(
            chunks
          ); /* similar to an array of integers, the buffer class transforms data into a binary stream of data. This concatenates the information together */
          const decoded = decodeURIComponent(
            buf
          ); /* get the decoded version of the buffered integers */
          const parsed = qs.parse(
            decoded
          ); /* The qs library working - decodes the buffer buffer stream */

          fs.writeFile(__dirname + "/saved-content.html", parsed.content) //Use the fs module to write to our file
            .then(() => {
              res.writeHead(301, {
                //Redirection
                "Content-Type": "text/html",
                Location: SERVE_URL
              });
              res.end("");
            })
            .catch((error) => {
              console.error(error);
              res.writeHead(500, {
                "Content-Type": "text/html"
              });
              res.end(error.toString());
            });
        });
    }
  }

  // Handle GET requests.
  if (req.method === "GET") {
    // Load the homepage from the file system.
    if (req.url === "/") {
      fs.readFile(__dirname + "/index.html")
        .then((contents) => {
          res.writeHead(200, {
            "Content-Type": "text/html"
          });
          res.end(contents);
        })
        .catch((error) => console.error(error));
    } else {
      // Provide not found errors for all other pages.
      res.writeHead(404);
      res.end("Not Found");
    }
  }

  // All other request methods but GET or POST.
  if (req.method !== "GET" && req.method !== "POST") {
    res.writeHead(404);
    res.end("Not Found");
  }
};

const server = http.createServer(requestListener);

server.listen(PORT, HOST, () => {
  console.log(`Server is running on ${SERVE_URL}`);
});

              
            
!
999px

Console