Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const serveIndex = require('serve-index');
- const express = require('express');
- const app = express();
- app.use('/project', express.static('public'))
- app.use('/project', serveIndex('public'))
- app.get('/', (req, res) =>; {
- res.send('Server Running.');
- });
- function createAccount() {
- // Create Account
- var mysql = require("mysql");
- var con = mysql.createConnection({
- host: "localhost",
- user: "root",
- password: "",
- database: "database1"
- });
- con.connect(function(err) {
- if (err) throw err;
- console.log("Connected!");
- var sql = "INSERT INTO `users` (`username`, `password`, `email`, `confirm_code`, `confirmed`, `plugin1`, `plugin2`, `plugin3`, `plugin4`, `plugin5`, `myplugin1`, `myplugin2`, `myplugin3`, `myplugin4`, `myplugin5`) VALUES ('" + username + "', '" + password + "', '" + email + "', '" + code + "', 'no', 'none', 'none','none', 'none', 'none', 'none', 'none', 'none', 'none', 'none');";
- con.query(sql, function (err, result) {
- if (err) throw err;
- console.log("1 record inserted");
- });
- });
- app.listen(3000, () =>; console.log('App running on port 3000.'));
- var username = "John Doe";
- var password = "1234";
- var email = "johndoe@example.com";
- var code = "1234";
- createAccount();
Add Comment
Please, Sign In to add comment