Skip to content

Instantly share code, notes, and snippets.

View icew1nd's full-sized avatar
🔥

Thomas icew1nd

🔥
  • Risskov, Denmark
View GitHub Profile
@icew1nd
icew1nd / start.js
Last active February 25, 2020 16:18
// Requiring modules we are going to use later
const inquirer = require("inquirer");
const util = require("util");
const execSync = util.promisify(require("child_process").execSync);
// Create the question prompter
const prompt = inquirer.createPromptModule();
// Get the build argument that we want to execute after the prompt
const finalBuild = process.argv[2];
{
"name": "testapp",
"scripts": {
"start": "node start.js 'react-scripts start'",
"build": "node start.js 'react-scripts build'",
}
}
const express = require("express");
const app = express();
const fs = require("fs");
app.get("/", function(req, res) {
res.send("Hello World");
});
app.listen(3000);
import { Router } from "express";
export const router: Router = Router();
router.get("/", (req, res) => {
res.status(200).send({
message: "v1"
});
});
import { Router } from "express";
var routesVersioning = require("express-routes-versioning")();
export const router: Router = Router();
router.get(
"/",
routesVersioning({
"1.0.0": (req: any, res: any) => {
res.status(200).send({
#! /usr/bin/env node
console.log("Im working");
#! /usr/bin/env node
const fs = require("fs-extra");
const installFolder = process.argv.slice(2)[0];
fs.mkdirSync("./" + installFolder);
{
"name": "sample-name",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js",
"dev": "nodemon app.js"
},
"dependencies": {
const express = require("express");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
#! /usr/bin/env node
const fs = require("fs-extra");
const installFolder = process.argv.slice(2)[0];
const path = require("path");
try {
fs.copySync(path.join(__dirname, "./template"), "./" + installFolder);
console.log("Copied base files");
} catch (err) {