Skip to content

Instantly share code, notes, and snippets.

View debelistic's full-sized avatar
🏠
Working from home

Victor Awotidebe debelistic

🏠
Working from home
View GitHub Profile
@debelistic
debelistic / dev
Created September 2, 2019 15:34
dev executable file for development
require('@babel/register');
require('@babel/core');
const config = require('dotenv').config;
const http = require('http');
const app = require('./../../src/index').default;
const server = http.createServer(app);
config();
const port = parseInt(process.env.PORT, 10);
@debelistic
debelistic / .babelrc
Created September 2, 2019 14:56
Configuration for babel
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
}
@debelistic
debelistic / .env
Last active September 6, 2019 16:21
A sample environment variable file
PORT=5000
DB_USER=
DB_HOST=
DB_NAME=
DB_PASSWORD=
SECRET=randomstring
@debelistic
debelistic / www
Last active September 2, 2019 14:59
A sample www excutable production file for listening to server in NodeJS
const http = require('http');
const config = require('dotenv').config;
const app = require('../../dist/index.js').default;
const server = http.createServer(app);
config();
const port = parseInt(process.env.PORT, 10);
server.listen(port, () => console.log('Listening on port', port));
@debelistic
debelistic / package.json
Last active September 2, 2019 14:50
A start and devstart script for node app
"scripts": {
"start": "node src/bin/www",
"devstart": "babel-watch src/bin/dev",
"build": "rm -rf dist && mkdir dist && babel src -s -d dist",
"test": "echo \"Error: no test specified\" && exit 1"
}
@debelistic
debelistic / index.js
Last active September 4, 2019 14:07
start server app
import express from 'express';
import { config } from 'dotenv';
import routes from './routes';
config();
const app = express();
app.use(routes);
app.use((req, res, next) => {
{
"name": "nodeAPI",
"version": "1.0.0",
"description": "A node API covering postgres database, creating model with sequelize and authentication with jwt.",
"main": "index.js",
"scripts": {
"build": "rm -rf dist && mkdir dist && babel src -s -d dist",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="root">
@debelistic
debelistic / .eslintrc
Last active August 13, 2019 16:14
Sample Eslint configuraion with Airbnb style guide
{
"extends": ["airbnb"],
"env": {
"browser": true,
"node": true,
"jest": true,
"commonjs": true
},
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }]
@debelistic
debelistic / App.js
Last active August 13, 2019 15:19
A sample react component
import React from 'react';
const App = () => {
return (
<div>
<h1>You just setup react with babel and eslint</h1>
</div>
);
};