Skip to content

Instantly share code, notes, and snippets.

Avatar

Kouji Nakashima kuc-arc-f

View GitHub Profile
@kuc-arc-f
kuc-arc-f / .babelrc
Last active Jan 23, 2021
axios, strapi post sample
View .babelrc
{
"presets": [
"@babel/preset-env"
]
}
@kuc-arc-f
kuc-arc-f / auth_check.js
Created Jan 15, 2021
Next.js, Login auth sample
View auth_check.js
const bcrypt = require('bcrypt');
var AUTH_MAIL = "hoge@example.com"
var AUTH_PASSWORD="1111"
//
export default async (req, res) => {
try{
if (req.method === "POST") {
var data = req.body
console.log(data)
@kuc-arc-f
kuc-arc-f / test_login.js
Created Jan 15, 2021
Next.js, Login sample
View test_login.js
// Next.js, Login sample
import Layout from '../components/layout'
import React from 'react'
import cookies from 'next-cookies'
class Page extends React.Component {
static async getInitialProps(ctx) {
return {
initialName: ''
@kuc-arc-f
kuc-arc-f / test.js
Created Jan 14, 2021
Next.js, flash get sample
View test.js
// Next.js, flash get sample
import flash from 'next-flash';
import Head from 'next/head';
import Link from 'next/link';
import React from 'react'
export default class Page extends React.Component {
static async getInitialProps (ctx) {
return flash.get(ctx) || {}
@kuc-arc-f
kuc-arc-f / test_flash.js
Created Jan 14, 2021
Next.js, flash set sample
View test_flash.js
// Next.js, flash set sample
import flash from 'next-flash';
import Head from 'next/head';
import Link from 'next/link';
import React from 'react'
import Router from 'next/router'
export default class Page extends React.Component {
static async getInitialProps (ctx) {
return flash.get(ctx) || {}
@kuc-arc-f
kuc-arc-f / test_cookie.js
Last active Jan 14, 2021
Next.js cookie set sample
View test_cookie.js
@kuc-arc-f
kuc-arc-f / docker-compose.yml
Created Dec 20, 2020
mongoDB の、docker-compose.yml
View docker-compose.yml
version: '3'
services:
mongo:
image: mongo
command:
- mongod
ports:
- 27017:27017
volumes:
- mongo-data:/data/db
@kuc-arc-f
kuc-arc-f / test5_mongo2.js
Last active Dec 20, 2020
複数の mongodb に接続する例
View test5_mongo2.js
//
// mongo , mongo2 の接続
// 複数の mongodb に接続する例
//
var ObjectID = require('mongodb').ObjectID;
const MongoClient = require('mongodb').MongoClient;
var moment = require('moment')
//
async function test1(){
@kuc-arc-f
kuc-arc-f / join_2.js
Last active Dec 11, 2020
mongo find() ,IN の検証
View join_2.js
//
// mongo finc() ,IN の検証
var ObjectID = require('mongodb').ObjectID;
const MongoClient = require('mongodb').MongoClient;
//
function join_test3(){
var URL = "mongodb://localhost:27017";
MongoClient.connect(URL, (err, client) => {
var db = client.db("db1");
@kuc-arc-f
kuc-arc-f / add.txt
Last active Dec 11, 2020
mongo aggregate,group の検証
View add.txt
// add data
db.book_groups.insertMany([
{ dept_name: "dept-1", name: "group-1" },
{ dept_name: "dept-1", name: "group-2" },
{ dept_name: "dept-2", name: "group-11" },
]);
//
db.book_groups.aggregate(
{